public class GraphInfo extends Object
Constructor and Description |
---|
GraphInfo(SGraph completeGraph,
GraphAlgebra algebra)
Creates a
GraphInfo object representing completeGraph , with respect to the given algebra. |
Modifier and Type | Method and Description |
---|---|
int |
dist(int vNr1,
int vNr2)
Returns the distance between nodes
VNr1 and vNr2 . |
int[] |
getAllEdges()
Returns the array containing the IDs of all edges in the represented graph.
|
int[] |
getAllIncidentEdges(IntSet vertices)
Returns the IDs of all edges incident to any vertex in the set
vertices . |
int |
getDecidingEdgePWSP(int[] vSet,
int v)
Returns the last edge on the shortest path from node
v to a node in vSet . |
GraphEdge |
getEdge(int edgeID)
Returns the edge corresponding to
edgeID . |
int |
getEdge(int source,
int target)
Returns the ID of the edge with the given
source and target if it exists. |
int |
getEdgeId(GraphEdge edge)
Returns the ID for
edge . |
int |
getEdgeSource(int e)
Returns the source vertex of
e . |
int |
getEdgeTarget(int e)
Returns the target vertex of
e . |
int[] |
getIncidentEdges(int nodeID)
Returns the IDs of all edges incident to the node given by
nodeID . |
int |
getIntForNode(String nodename)
Returns the integer ID for the node with name
nodename . |
int |
getIntForSource(String source)
Returns the integer ID for
source . |
int[] |
getlabelSources(int labelId)
Returns the IDs of all sources appearing in the algebra label given by .
|
int |
getMaxDegree()
Returns the maximum degree in the represented SGraphs (loops count once).
|
String |
getNodeForInt(int nodeID)
Returns the node name corresponding to
nodeID . |
int |
getNrEdges()
Returns the total number of edges in the represented graph.
|
int |
getNrNodes()
Returns the total number of nodes in the represented graph.
|
int |
getNrSources()
Gives the total number of sources used in the algebra.
|
int |
getOtherNode(int e,
int v)
The edge
e has a source and a target, if v is one, this returns the other. |
SGraph |
getSGraph()
Returns the represented
SGraph . |
String |
getSourceForInt(int sourceID)
Returns the source name corresponding to
sourceID . |
boolean |
isIncident(int vertex,
int edge)
Returns true iff
edge is incident to vertex . |
boolean |
useBytes()
describes whether we should use shorts or bytes to represent edges and vertices (depends purely on graph size).
|
public GraphInfo(SGraph completeGraph, GraphAlgebra algebra)
GraphInfo
object representing completeGraph
, with respect to the given algebra.
Also computes distances between nodes using Floyd-Warshall , runtime O(n^3).completeGraph
- algebra
- public final int getIntForSource(String source)
source
.source
- public int getIntForNode(String nodename)
nodename
.nodename
- public String getSourceForInt(int sourceID)
sourceID
.sourceID
- public String getNodeForInt(int nodeID)
nodeID
.nodeID
- public int getNrSources()
public int[] getAllIncidentEdges(IntSet vertices)
vertices
.vertices
- public int[] getIncidentEdges(int nodeID)
nodeID
.nodeID
- public final int getNrNodes()
public int[] getlabelSources(int labelId)
labelId
- public final int getNrEdges()
public final boolean isIncident(int vertex, int edge)
edge
is incident to vertex
.vertex
- edge
- public int getEdgeId(GraphEdge edge)
edge
.edge
- public final int[] getAllEdges()
public int getOtherNode(int e, int v)
e
has a source and a target, if v
is one, this returns the other.
Otherwise, i.e. if e
is not incident to v
, this returns -1.e
- v
- public int getEdgeSource(int e)
e
.e
- public int getEdgeTarget(int e)
e
.e
- public int getEdge(int source, int target)
source
and target
if it exists. Otherwise returns -1.source
- target
- public GraphEdge getEdge(int edgeID)
edgeID
.edgeID
- public SGraph getSGraph()
SGraph
.public int getMaxDegree()
public boolean useBytes()
public int getDecidingEdgePWSP(int[] vSet, int v)
v
to a node in vSet
.
Uses the previously stored information computed via Floyd-Warshall.
Runtime is linear in the size of vSet
.vSet
- v
- public int dist(int vNr1, int vNr2)
VNr1
and vNr2
.
Precomputed via Floyd-Warshall, has constant runtime.vNr1
- vNr2
- Copyright © 2017. All rights reserved.