Graph Class for Weighted Undirected Graph

Skip to first unread message

Feb 22, 2021, 1:58:29 PM2/22/21
to SNAP Users Group
Hello everyone,

I am new to SNAP and trying to create a "Weighted Undirected Graph". That means, each edge associated with a positive weight. For my case, which Graph Class would be suitable? 

Firstly I was thinking to use TUNGraph(Nodes, Edges). But the problem is, there is no attributes/data associated with the edge/node for this graph class. 

Secondly, I was considering using TNEANet(Nodes, Edges). This class allows me to add edge weight as the attribute.  My data is undirected.  In this case, do I need to add two directed edges from opposite directions between a pair of nodes in order to get all common neighbors? 

Or, would you please suggest the best way to handle this issue? Thank you.

Best regards,

Rok Sosic

Feb 23, 2021, 9:57:03 PM2/23/21


Yes, you are correct. Please use TNEANet and add two directed edges for each pair of connected nodes. You can use MakeUnDir() for this purpose, if you already have a graph.



You received this message because you are subscribed to the Google Groups "SNAP Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages