Interface GenericDirectedGraph

  • All Known Implementing Classes:
    GenericDirectedGraphGRPHimpl

    public interface GenericDirectedGraph
    Graph interaction methods to interact with directed graphs
    • 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 node
        to - the id of the ending node
        edgeName - 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 node
        featureName - can't be null or empty
        featureValue -
        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 node
        featureName - can't be null or empty
        featureValue -
        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 removed
        destinationId - if not blank only the edges with this destination id are removed
        kind - 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:
      • getNodeName

        String getNodeName​(Integer nodeId)
        Name of graph node
        Parameters:
        nodeId -
        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:
      • getEdgeName

        String getEdgeName​(Integer edgeId)
        Name of graph edges
        Parameters:
        edgeId -
        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:
      • getRoots

        Set<Integer> getRoots()
        Get the ids of root nodes
        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 filter
        sourceId -
        destinationId -
        name -
        Returns:
        filtered edges list
      • graphAsString

        String graphAsString​(GraphToStringENUM outputType)
        Serialize the graph contents as a string
        Parameters:
        outputType -
        Returns: