DGraph - YosefTwito/PackIt GitHub Wiki
- This interface represents a directional weighted graph.
- The interface has a road-system or communication network in mind - and should support a large number of nodes (over 100,000).
- The implementation is based on an efficient compact representation (fast run-time).
- @authors YosefTwito and EldarTakach
The DGraph:
DGraph's parameters:
- HashMap<Integer, node_data> nodesMap - contain all the nodes in the graph.
- HashMap<Integer, HashMap<Integer,edge_data>> edgesMap - contain all the edges in the graph.
- int edgesCounter.
- int MC (mode counter).
The functions of the DGraph are:
Constructor:
- DGraph().
- DGraph(DGraph G)
Methods:
- getNode(int key) - get a key and return the node with the given key.
- getEdge(int src, int dest) - get src and dst, return the edge from src-node to dest-node.
- addNode(node_data n) - add the given node to my nodeMap.
- connect(int src, int dest, double w) - create new edge from the given src-node to the given dest-node with weight=w.
- getV() - return a pointer (shallow copy) for the collection representing all the nodes in the graph.
- getE(int node_id) - return a pointer (shallow copy) for the collection representing all the edges getting out of the given node.
- removeNode(int key) - remove the node with the given id and all the edges related to it from the graph.
- removeEdge(int src, int dest) - remove the edge with the given parameters from the graph.
- nodeSize() - return the amount of nodes in the graph.
- edgeSize() - return the amount of edges in the graph.
- getMC() - return the MC(mode counter).