Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • graph-tool graph-tool
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 48
    • Issues 48
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Please use the issue tracker only to report bugs (i.e. errors in the library that need to be fixed) or feature requests.

For questions about how to compile, install or use the library, please use instead the web forum at https://forum.skewed.de/c/graph-tool.


(If unsure, use the forum first.)


IMPORTANT: When opening new issues, please choose the BUG template from the drop-down menu, and fill out the required information.

  • Tiago Peixoto
  • graph-toolgraph-tool
  • Issues
  • #92
Closed
Open
Issue created Aug 06, 2014 by Tiago Peixoto@count0Owner

g.reindex_edges() needs to take into account the edges property maps

When reindexing the edges on a graph (for instance, upon deleting edges (self loops for instance) the function should also take care to preserve the mapping with the edge_property maps. I don't know whether this is a bug (unintentional) or an improvement (a flag could be passed to the function in order to do so).

See example below:

#!python
In [66]: g=gt.Graph()

In [67]: g.add_vertex(2)

Out[67]: 
[<Vertex object with index '0' at 0x406c1d0>,
 <Vertex object with index '1' at 0x406c250>]

In [68]: g.add_edge(g.vertex(0),g.vertex(1))

Out[68]: <Edge object with source '0' and target '1' at 0x4066dd0>

In [69]: g.add_edge(g.vertex(1),g.vertex(0))

Out[69]: <Edge object with source '1' and target '0' at 0x4066f80>

In [70]: z=g.new_edge_property("int")

In [71]: z[g.edge(0,1)]=84

In [72]: z[g.edge(1,0)]=-84

In [73]: f= lambda x: z[x]==84 # to remove edges afterwards

In [74]: g.edge_properties["z"]=z

In [75]: for e in g.edges():
   ....:     print g.edge_properties['z'][e]
   ....:     
84
-84

In [77]: g.remove_edge_if(f) # remove edge

In [78]: for e in g.edges(): # this is ok
    print g.edge_properties["z"][e]
   ....:     
-84

In [79]: g.reindex_edges() #reindex

In [80]: for e in g.edges(): # this is NOT ok.
    print g.edge_properties["z"][e]
   ....:     
84
Assignee
Assign to
Time tracking