Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
0

Deleting a matching from a graph

asked 2 years ago

vidyarthi gravatar image

When I have a graph G and a perfect matching given by G.matching() or by using the independent set in its line graph, I wish to know whether there is a method to delete the matching edges from the edge set of the graph. Like, I want to know a method that gives GM1 for M1 being a matching in the graph. Is there any such method? Thanks beforehand..

Preview: (hide)

Comments

@DavidCoudert thanks! it works

vidyarthi gravatar imagevidyarthi ( 2 years ago )

1 Answer

Sort by » oldest newest most voted
3

answered 2 years ago

G.matching() returns a list of edges, so you can do:

sage: G = graphs.PetersenGraph()
sage: G.order(), G.size()
(10, 15)
sage: M = G.matching()
sage: G.delete_edges(M)
sage: G.order(), G.size()
(10, 10)
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2 years ago

Seen: 267 times

Last updated: May 02 '22