Closed mkoeppe closed 4 years ago
I have zero knowledge on manifolds, so I don't understand what's the idea/objective.
Connected graphs with positive edge weights define discrete metric spaces whose elements are the vertices and whose distance function is the length of the shortest path between the vertices.
The mentioning of manifolds is just an indication of where the axiom is used. So what I believe is being proposing is to allow the axiom to be added to the category of graphs with a default metric function being the usual distance between vertices.
That's right.
I'm not used to the terminology of category
, but I understand some relationships between graphs and metric spaces (I did some work on Gromov hyperbolicity).
If I understand well, you want a new class ConnectedGraphs
, that inherits from Graphs
and overwrites delete_edge
and delete_vertex
to raise an error if the removal of a vertex or an edge disconnects the graph.
The class should also get a check_weight
method to check that edge weights are positive.
More work would certainly be needed to ensure that a subgraph of a connected graph is of the same type, etc. right?
Great point, of course, regarding delete_edge
etc.
Is there currently a way to make graphs immutable?
Replying to @dcoudert:
More work would certainly be needed to ensure that a subgraph of a connected graph is of the same type, etc. right?
Right. This can be done by calling self.__class__
or self.parent()
rather than Graph()
.
Immutable: a graph can be immutable, but we cannot flip from one state to another. This is done via a copy like Graph(G, immutable=True)
using self.__class__
or self.parent()
is a good idea, but may be not so easy to do. We have to correct/modify many parts of the code...
I think we can at least solve the immediate issue of adding the axiom Connected
to the graph category. So I did this in the highest place it makes sense: simplicial complexes. With this, we have the natural category for those that want to use it. The later steps of adding the refinement to the graph class can come on a later ticket.
New commits:
6b99a12 | Added connected to simplicial complexes. |
47836ad | Added that a connected graph is a metric space. |
Author: Travis Scrimshaw
Replying to @dcoudert:
- Immutable: a graph can be immutable, but we cannot flip from one state to another. This is done via a copy like
Graph(G, immutable=True)
Thanks.
Replying to @tscrim:
I think we can at least solve the immediate issue of adding the axiom
Connected
to the graph category. So I did this in the highest place it makes sense: simplicial complexes. With this, we have the natural category for those that want to use it.
This looks great. In sage.categories.simplicial_complexes
I see you have already planned for categories to express more general cell complexes.
I'll play with this a little bit and wait for the patchbot
sage: CSC = SimplicialComplexes().Connected()
sage: L = SimplicialComplex([[1,2], [1,4]], category=CSC & SimplicialComplexes().Finite())
sage: L in CSC
True
sage: II = SimplicialComplex([[1,4], [2,3]], category=CSC & SimplicialComplexes().Finite())
sage: II in CSC
True
Should something be added to make sure that the second example raises an error?
No category does explicit tests checking whether or not an object belongs to it. Something we could add is a _test_connected
method, so that it gets picked up by a run of the TestSuite
. Perhaps we could add it to the __contains__
method, but the fact that the category is set would basically override any reasonable test.
Reviewer: Matthias Koeppe
Thanks for the explanation! Let's continue on follow-up tickets.
Changed branch from public/categories/connected_simplicial_complexes-30126 to 47836ad
There is the category of
Graphs
and there is an axiom 'Connected' (used inManifolds
), but so far there is no category of connected graphs. They would be metric spaces... if edge weights are positive.CC: @tscrim @dcoudert
Component: graph theory
Author: Travis Scrimshaw
Branch/Commit:
47836ad
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/30126