#13294: Add test for not necessarly induced subgraphs to Graph.is_subgraph() 
method
----------------------------+-----------------------------------------------
   Reporter:  steven        |             Owner:  jason, ncohen, rlm     
       Type:  enhancement   |            Status:  new                    
   Priority:  minor         |         Milestone:  sage-5.2               
  Component:  graph theory  |          Keywords:  graph, induced subgraph
Work issues:                |   Report Upstream:  N/A                    
  Reviewers:                |           Authors:                         
  Merged in:                |      Dependencies:                         
   Stopgaps:                |  
----------------------------+-----------------------------------------------
 That attached patch allows for testing if a graph is a subgraph of
 another,
 either induced or not.
 The current implementation only tests for
 induced subgraphs.

 A boolean parameter named "induced" has been added to Graph.is_subgrapg().
 That parameter defaults to True for backward compatibility.

 {{{
 def is_subgraph(self, other, induced=True):
 }}}

 If induced is True the method behaves like the current one, testing if
 'self' is an *induced* subgraph of other.

 If induces is False the method tests if all vertices and all edges of self
 are also in other.

 This example illustrates the difference:
 {{{
             sage: H=graphs.CycleGraph(5)
             sage: G=graphs.PathGraph(5)
             sage: G.is_subgraph(H)
             False
             sage: G.is_subgraph(H, induced=False)
             True
 }}}

 The patch also includes a couple of fixes regarding docstrings.

 As a personal note, I think that since the method is named "is_subgraph"
 and not "is_induced_subgraph" the default behaviour is counter-intuitive.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13294>
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.

Reply via email to