#8330: BipartiteGraph needs to override methods to add and delete vertices and
edges
----------------------------+-----------------------------------------------
Reporter: rhinton | Owner: rhinton
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.3.4
Component: graph theory | Keywords: BipartiteGraph
Author: Ryan Hinton | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
----------------------------+-----------------------------------------------
Changes (by rhinton):
* cc: ncohen (added)
Old description:
> !BipartiteGraph needs to hook delete_vertex() and delete_vertices().
>
> {{{
> sage: g = BipartiteGraph(graphs.CycleGraph(4))
> sage: (g.left, g.right)
> ([0, 2], [1, 3])
> sage: g.delete_vertex(0)
> sage: g.left
> [0, 2]
> }}}
> Note vertex 0 still shows up in the left partition.
>
> It should also hook the add_vertex() and add_edge() (and similar) calls,
> but not sure of the right way to do this.
New description:
!BipartiteGraph needs to hook delete_vertex() and delete_vertices().
{{{
sage: g = BipartiteGraph(graphs.CycleGraph(4))
sage: (g.left, g.right)
([0, 2], [1, 3])
sage: g.delete_vertex(0)
sage: g.left
[0, 2]
}}}
Note vertex 0 still shows up in the left partition.
It should also override add_vertex()
{{{
sage: g = BipartiteGraph()
sage: g.add_vertex('a')
sage: g.left
[]
sage: g.right # where did it go?
[]
}}}
and add_edge().
{{{
sage: g = BipartiteGraph(Graph({'a':['b','c']}))
sage: g.left
['a']
sage: g.right
['b','c']
sage: g.add_edge('b', 'c') # violates bipartition, should raise exception
}}}
--
Comment:
changing the ticket to handle add and delete methods for completeness
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8330#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.