Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The name/ family name of the (di)graph is preserved on addition/ deletion of a vertex/ an edge. #38768

Open
2 tasks done
janmenjayap opened this issue Oct 4, 2024 · 0 comments
Labels

Comments

@janmenjayap
Copy link
Contributor

Steps To Reproduce

Consider the following example:
Upon deleting a vertex from the Petersen graph, the string representation of the resulting graph still states that the new graph is the Petersen graph.

sage: P = graphs.PetersenGraph()
sage: P
Petersen graph: Graph on 10 vertices
sage: P.delete_vertex(0)
sage: P
Petersen graph: Graph on 9 vertices

Upon deleting an edge from a cycle graph, the string representation of the resulting graph still states that the new graph is a cycle graph:

sage: G = graphs.CycleGraph(4)
sage: G
Cycle graph: Graph on 4 vertices
sage: G.delete_edge(0, 1)
sage: G
Cycle graph: Graph on 4 vertices

An analogous result can be observed for each instance of a named (di)graph/ (di)graph of a particular family. An example for digraph goes as follows:

sage: D = digraphs.Circuit(5)
sage: D
Circuit: Digraph on 5 vertices
sage: D.delete_edge(0, 1)
sage: D
Circuit: Digraph on 5 vertices

Analogous behaviour may be observed in case of addition of a vertex/ an edge:

sage: G = graphs.CycleGraph(4)
sage: G
Cycle graph: Graph on 4 vertices
sage: G.add_vertex()
4
sage: G
Cycle graph: Graph on 5 vertices

Expected Behavior

A (possible) expected behaviour can be to remove the prefix substring pertaining to the family name/ name of the (di)graph on the addition/ deletion of a vertex/ an edge. The expected behaviour for the above mentioned examples are listed below:

sage: P = graphs.PetersenGraph()
sage: P
Petersen graph: Graph on 10 vertices
sage: P.delete_vertex(0)
sage: P
Graph on 9 vertices
sage: G = graphs.CycleGraph(4)
sage: G
Cycle graph: Graph on 4 vertices
sage: G.delete_edge(0, 1)
sage: G
Graph on 4 vertices
sage: D = digraphs.Circuit(5)
sage: D
Circuit: Digraph on 5 vertices
sage: D.delete_edge(0, 1)
sage: D
Digraph on 5 vertices
sage: G = graphs.CycleGraph(4)
sage: G
Cycle graph: Graph on 4 vertices
sage: G.add_vertex()
4
sage: G
Graph on 5 vertices

Actual Behavior

The name/ family name of the (di)graph is preserved on addition/ deletion of a vertex/ an edge. For examples see the section: Steps to reproduce

Additional Information

This problem may be solved by setting self.name() or the output of self.str() to '' on the addition/ deletion of a vertex/ an edge.

This issue shall also be corrected for the addition of cliques, cycles, paths and removable of multiedges.

Environment

  • OS: Ubuntu 20.04.6 LTS (Focal Fossa)
  • Sage Version: 10.5.beta6

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant