Interface GenericDirectedGraph
-
- All Known Implementing Classes:
GenericDirectedGraphGRPHimpl
public interface GenericDirectedGraph
Graph interaction methods to interact with directed graphs
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Integer
addEdge(Integer from, Integer to, String edgeName)
Add a new edge (directed)boolean
addEdgeFeature(Integer edgeId, String featureName, Object featureValue)
Add the named feature to the edge.Integer
addNode(Integer nodeId, String nodeName)
Add a new nodeboolean
addNodeFeature(Integer nodeId, String featureName, Object featureValue)
Add the named feature to the node.boolean
changeEdgeName(Integer edgeId, String edgeName)
Change the name of an existing edge - the new name should not be empty or nullboolean
changeNodeName(Integer nodeId, String nodeName)
Set a new name of an existing nodeMap<Integer,org.apache.commons.lang3.tuple.Pair<Integer,Integer>>
getAllEdgeConnections()
Map with id (key) of edges and pair of id of the nodes each vertex connectsSet<Integer>
getChildrenNodes(Integer nodeId)
Get the ids of all the children of a nodeInteger
getChildrenNodesCount(Integer nodeId)
Get the number of children of the nodeInteger
getEdgeCount()
Number of edgesMap<String,Object>
getEdgeFeatures(Integer edgeId)
Get the named edge feature mapString
getEdgeName(Integer edgeId)
Name of graph edgesMap<Integer,String>
getEdgeNames(Integer edgeId)
Map with id (key) and name of graph edgesSet<Integer>
getEdgesByKindSourceAndDestination(Integer sourceId, Integer destinationId, String name)
Get edges by source node id / destination node id / name At least on of source node Id / destination node Id / name has not to be blank / empty.Set<Integer>
getEdgesByName(String name)
Get the set of edges with with a specific nameMap<Integer,org.apache.commons.lang3.tuple.Pair<Integer,Integer>>
getIncidentEdges(Integer nodeId)
Get the set of edges entering in the nodeInteger
getNodeCount()
Number of nodesMap<String,Object>
getNodeFeatures(Integer nodeId)
Get the named node feature mapString
getNodeName(Integer nodeId)
Name of graph nodeMap<Integer,String>
getNodeNames(Integer nodeId)
Map with id (key) and name of graph nodesSet<Integer>
getNodesByName(String name)
Get the set of nodes with with a specific nameMap<Integer,org.apache.commons.lang3.tuple.Pair<Integer,Integer>>
getOutgoingEdges(Integer nodeId)
Get the set of edges going out from the nodeSet<Integer>
getParentNodes(Integer nodeId)
Get the ids of all the parents of a nodeInteger
getParentNodesCount(Integer nodeId)
Get the number of parents of the nodeSet<Integer>
getRoots()
Get the ids of root nodesString
graphAsString(GraphToStringENUM outputType)
Serialize the graph contents as a stringboolean
removeEdge(Integer edgeId)
Remove an edgeint
removeEdgesByNameSourceAndDestination(Integer sourceId, Integer destinationId, String name)
Remove all edges with a specific source node id / destination node id / name At least one of source node Id / destination node Id / name has not to be blank / empty.boolean
removeNode(Integer nodeId)
Remove a node together with all its incident edges
-
-
-
Method Detail
-
addNode
Integer addNode(Integer nodeId, String nodeName)
Add a new node- Parameters:
nodeId
- if null the first available id will be chosen for this node (the ID of the node is unambiguous graph-wide)nodeName
- each node should have a name (leaving null or empty will not create the node)- Returns:
- the id of the new node. If null the new node has not been added
-
changeNodeName
boolean changeNodeName(Integer nodeId, String nodeName)
Set a new name of an existing node- Parameters:
nodeId
-nodeName
- not null or empty- Returns:
-
removeNode
boolean removeNode(Integer nodeId)
Remove a node together with all its incident edges- Parameters:
nodeId
-- Returns:
-
removeEdge
boolean removeEdge(Integer edgeId)
Remove an edge- Parameters:
edgeId
-- Returns:
-
addEdge
Integer addEdge(Integer from, Integer to, String edgeName)
Add a new edge (directed)- Parameters:
from
- the id of the starting nodeto
- the id of the ending nodeedgeName
- each node should have a name (leaving null or empty will not create the node)- Returns:
-
changeEdgeName
boolean changeEdgeName(Integer edgeId, String edgeName)
Change the name of an existing edge - the new name should not be empty or null- Parameters:
edgeId
-edgeName
-- Returns:
-
addNodeFeature
boolean addNodeFeature(Integer nodeId, String featureName, Object featureValue)
Add the named feature to the node. If a node feature with this name is present, the feature is overwritten.- Parameters:
nodeId
- the id of the nodefeatureName
- can't be null or emptyfeatureValue
-- Returns:
- true if the feature is added
-
addEdgeFeature
boolean addEdgeFeature(Integer edgeId, String featureName, Object featureValue)
Add the named feature to the edge. If an edge feature with this name is present, the feature is overwritten.- Parameters:
nodeId
- the id of the nodefeatureName
- can't be null or emptyfeatureValue
-- Returns:
- true if the feature is added
-
removeEdgesByNameSourceAndDestination
int removeEdgesByNameSourceAndDestination(Integer sourceId, Integer destinationId, String name)
Remove all edges with a specific source node id / destination node id / name At least one of source node Id / destination node Id / name has not to be blank / empty. (AND OF source id, destination id and kind checks)- Parameters:
sourceId
- if not blank only the edges with this source id are removeddestinationId
- if not blank only the edges with this destination id are removedkind
- if not blank only the edges of this kind are removed- Returns:
- number of edges removed
-
getNodesByName
Set<Integer> getNodesByName(String name)
Get the set of nodes with with a specific name- Parameters:
name
-- Returns:
-
getNodeNames
Map<Integer,String> getNodeNames(Integer nodeId)
Map with id (key) and name of graph nodes- Parameters:
nodeId
- If null all the node names are retrieved. Otherwise only the name of the node with the specified id, if present.- Returns:
-
getEdgesByName
Set<Integer> getEdgesByName(String name)
Get the set of edges with with a specific name- Parameters:
name
-- Returns:
-
getEdgeNames
Map<Integer,String> getEdgeNames(Integer edgeId)
Map with id (key) and name of graph edges- Parameters:
edgeId
- If null all the edge names are retrieved. Otherwise only the name of the edge with the specified id, if present.- Returns:
-
getNodeCount
Integer getNodeCount()
Number of nodes- Returns:
-
getEdgeCount
Integer getEdgeCount()
Number of edges- Returns:
-
getChildrenNodes
Set<Integer> getChildrenNodes(Integer nodeId)
Get the ids of all the children of a node- Parameters:
nodeId
-- Returns:
-
getChildrenNodesCount
Integer getChildrenNodesCount(Integer nodeId)
Get the number of children of the node- Parameters:
nodeId
-- Returns:
-
getParentNodes
Set<Integer> getParentNodes(Integer nodeId)
Get the ids of all the parents of a node- Parameters:
nodeId
-- Returns:
-
getParentNodesCount
Integer getParentNodesCount(Integer nodeId)
Get the number of parents of the node- Parameters:
nodeId
-- Returns:
-
getIncidentEdges
Map<Integer,org.apache.commons.lang3.tuple.Pair<Integer,Integer>> getIncidentEdges(Integer nodeId)
Get the set of edges entering in the node- Parameters:
nodeId
-- Returns:
-
getOutgoingEdges
Map<Integer,org.apache.commons.lang3.tuple.Pair<Integer,Integer>> getOutgoingEdges(Integer nodeId)
Get the set of edges going out from the node- Parameters:
nodeId
-- Returns:
-
getAllEdgeConnections
Map<Integer,org.apache.commons.lang3.tuple.Pair<Integer,Integer>> getAllEdgeConnections()
Map with id (key) of edges and pair of id of the nodes each vertex connects- Parameters:
edgeId
-- Returns:
-
getNodeFeatures
Map<String,Object> getNodeFeatures(Integer nodeId)
Get the named node feature map- Parameters:
nodeId
-- Returns:
-
getEdgeFeatures
Map<String,Object> getEdgeFeatures(Integer edgeId)
Get the named edge feature map- Parameters:
edgeId
-- Returns:
-
getEdgesByKindSourceAndDestination
Set<Integer> getEdgesByKindSourceAndDestination(Integer sourceId, Integer destinationId, String name)
Get edges by source node id / destination node id / name At least on of source node Id / destination node Id / name has not to be blank / empty. (AND OF source node id, destination node id and name checks)- Parameters:
edgeList
- list of edges to filtersourceId
-destinationId
-name
-- Returns:
- filtered edges list
-
graphAsString
String graphAsString(GraphToStringENUM outputType)
Serialize the graph contents as a string- Parameters:
outputType
-- Returns:
-
-