public class DirectedGraphRepresentation extends Object implements Representation
Modifier and Type | Field and Description |
---|---|
static String |
EDGE_SEPARATOR |
protected List<GraphNode> |
nodes |
protected List<NodeDistance> |
nodesDistances |
protected gnu.trove.map.hash.TIntIntHashMap |
nodesIdToGraphObjs |
Constructor and Description |
---|
DirectedGraphRepresentation() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(Integer firstNodeId,
Integer secondNodeId)
Adds an edge between the nodes whose IDs are
firstNodeId
and secondNodeId |
void |
addNode(Integer nodeId,
StructureElement nodeContent)
Adds a node whose id is
nodeId and whose content is nodeContent |
List<NodeDistance> |
getNodeDistances()
Returns the list of NodeDistance Objects
|
GraphNode |
getNodeFromID(Integer Id)
Given a node id, return the corresponding GraphNode object
|
List<GraphNode> |
getNodeList()
Returns a list containing all the nodes in this graph
|
int |
getNumberOfNodes()
Returns the number of nodes in the graph.
|
String |
getTextFromData()
Returns a textual representation of the data stored in this
representation
|
boolean |
isCompatible(Representation rep)
Evaluates whether a representation is compatible with this one, e.g.., they have
same type and pass additional checks that are type-dependent
|
void |
setDataFromText(String graphString)
Initializes a Representation using its textual description provided in
representationDescription |
public static final String EDGE_SEPARATOR
protected gnu.trove.map.hash.TIntIntHashMap nodesIdToGraphObjs
protected List<NodeDistance> nodesDistances
public String getTextFromData()
Representation
getTextFromData
in interface Representation
public void setDataFromText(String graphString) throws Exception
Representation
representationDescription
setDataFromText
in interface Representation
graphString
- the textual description of the representation to be
initializedException
public GraphNode getNodeFromID(Integer Id)
Id
- public void addNode(Integer nodeId, StructureElement nodeContent)
nodeId
and whose content is nodeContent
nodeId
- the id of the node to be addednodeContent
- the content of the node to be addedpublic void addEdge(Integer firstNodeId, Integer secondNodeId)
firstNodeId
and secondNodeId
firstNodeId
- the id of the first nodesecondNodeId
- the id of the second nodepublic List<GraphNode> getNodeList()
public int getNumberOfNodes()
public List<NodeDistance> getNodeDistances()
public boolean isCompatible(Representation rep)
Representation
isCompatible
in interface Representation
rep
- the representation to be compared with this oneCopyright © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.