wting / python-graph

Automatically exported from code.google.com/p/python-graph
Other
5 stars 3 forks source link

Delete edge function for hypergraphs #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The hyperedge class does not have a del_hyperedge function.
only an unlink function...

Original issue reported on code.google.com by anand.ib...@gmail.com on 28 Nov 2009 at 1:01

GoogleCodeExporter commented 9 years ago
Could you attach your patch for this here, Anand?

Original comment by pmatiello on 28 Nov 2009 at 3:54

GoogleCodeExporter commented 9 years ago
of course i just thought i will finish adding the test functions too..... when 
is
1.6.3 planned for delivery??

Original comment by anand.ib...@gmail.com on 28 Nov 2009 at 5:18

GoogleCodeExporter commented 9 years ago
and here is the patch, i managed to test successfully.....

Original comment by anand.ib...@gmail.com on 28 Nov 2009 at 9:26

Attachments:

GoogleCodeExporter commented 9 years ago
Anand, could please send a space-indented version of this? Tabs are confusing
everything here and can't make your patch work. Too many whitespace issues.

If you prefer, you can also send me your del_edge function and the test 
functions
plainly, not in patch format, and I'll add them manually.

Original comment by pmatiello on 29 Nov 2009 at 5:12

GoogleCodeExporter commented 9 years ago
@pedro: I can take this issue if you want. Let me know.

Original comment by christian.muise on 29 Nov 2009 at 5:57

GoogleCodeExporter commented 9 years ago
The del_hyperedge function:

def del_hyperedge(self,hyperedge):
        """
        Delete the given hyperedge(s)
        """
        if (hyperedge in self.hyperedges()):
            for n in self.edge_links[hyperedge]:
                self.node_links[e].remove(hyperedge)

            self.edge_links.pop(hyperedge)
            self.graph.del_edge((hyperedge,'h'))

Original comment by anand.ib...@gmail.com on 30 Nov 2009 at 4:06

GoogleCodeExporter commented 9 years ago
and the test function:
def test_remove_hyperedge(self):
        gr = testlib.new_hypergraph()
        edge_no = len(gr.nodes())+1
        gr.del_hyperedge(edge_no)
        self.assertTrue(edge_no not in gr.hyperedges())

sorry for the goofup and the delay was using gedit.. will use vim next time.

Original comment by anand.ib...@gmail.com on 30 Nov 2009 at 4:09

GoogleCodeExporter commented 9 years ago
Thanks anand!
  With a few bug fixes, it's currently put into r644. Marking as closed.

Original comment by christian.muise on 30 Nov 2009 at 4:43

GoogleCodeExporter commented 9 years ago

Original comment by christian.muise on 30 Nov 2009 at 4:43