I am not aware of any OOTB converters between SNAP and igraph graph objects, and building one that works reliably would probably require careful consideration as the graph models of SNAP and igraph are slightly different. For instance:
- igraph requires node IDs to be contiguous integers starting at zero while SNAP doesn’t, so SNAP objects can only be mapped to igraph graphs by using a separate “id” vertex attribute on the igraph side that corresponds to the original (non-contiguous) SNAP ID - snap.TUNGraph and snap.TNGraph do not support multiple edges between nodes (as far as I know), so mapping igraph graphs with multiple edges back to a snap.TUNGraph or snap.TNGraph is not possible (only to a snap.TNEANet). Attributes are also supported only with tNEANet. - Attributes in a snap.TNEANet are “typed” so you cannot mix attributes of different type for the same attribute name. igraph graphs exploiting this feature (such as having an integer attribute with occasional None values to represent missing data) have to be handled during the conversion explicitly. - snap.TNEANet supports integers, floats and strings only, so any other attribute type in igraph (e.g., Unicode, or an arbitrary Python object) has to be handled explicitly. On the other hand, if your graphs do not have attributes and/or you only want to preserve the structure, you can get an edge list from igraph using the get_edgelist() method and then use that to construct the same graph in SNAP. -- T. ------------------------------------------------------ From: Jeff Hemsley [email protected] Reply: Help for igraph users [email protected] Date: 10 April 2014 at 16:04:47 To: [email protected] [email protected], Help for igraph users [email protected] Subject: Re: [igraph] snap & igraph > Hi Sam, > Did anyone answer your question? I'm curious too. > > On Wed, Apr 9, 2014 at 2:30 PM, Sam Steingold wrote: > > Hi, > > Both igraph and SNAP (http://snap.stanford.edu/) provide Python > > interface. > > Is there a way to use both on the same graph? > > I.e., are there any OOTB converters between SNAP and igraph objects? > > Thanks! > > -- > > Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1265 > > http://www.childpsy.net/ http://mideasttruth.com http://jihadwatch.org > > http://thereligionofpeace.com http://camera.org > > http://islamexposedonline.com > > A number problem "solved" with floats turns into 1.9999999999999998 > > problems. > > > > _______________________________________________ > > igraph-help mailing list > > [email protected] > > https://lists.nongnu.org/mailman/listinfo/igraph-help > > > > -- > > -- > Jeff Hemsley > Doctoral Candidate > Author of Going Viral, Polity Press > The Information School > University of Washington > http://staff.washington.edu/jhemsley/ > http://somelab.net/author/jhemsley/ > [email protected] > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help > _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
