Class FastUndirectedWeightedMultiEdges

java.lang.Object
es.uam.eps.ir.relison.graph.multigraph.edges.fast.FastMultiEdges
es.uam.eps.ir.relison.graph.multigraph.edges.fast.FastUndirectedWeightedMultiEdges
All Implemented Interfaces:
MultiEdges, UndirectedMultiEdges, WeightedMultiEdges

public class FastUndirectedWeightedMultiEdges
extends FastMultiEdges
implements UndirectedMultiEdges, WeightedMultiEdges
Fast implementation of undirected weighted edges for multigraphs.
  • Constructor Details

  • Method Details

    • getNeighbourNodes

      public java.util.stream.Stream<java.lang.Integer> getNeighbourNodes​(int node)
      Description copied from interface: MultiEdges
      Gets the full neighbourhood of a node.
      Specified by:
      getNeighbourNodes in interface MultiEdges
      Parameters:
      node - The node.
      Returns:
      a stream containing all the ids of the nodes.
    • getNeighbourTypes

      public java.util.stream.Stream<MultiEdgeTypes> getNeighbourTypes​(int node)
      Description copied from interface: MultiEdges
      Gets the types of the neighbourhood edges of a node.
      Specified by:
      getNeighbourTypes in interface MultiEdges
      Parameters:
      node - The node.
      Returns:
      a stream containing all the edge types.
    • getNeighbourWeights

      public java.util.stream.Stream<MultiEdgeWeights> getNeighbourWeights​(int node)
      Description copied from interface: MultiEdges
      Gets the weights of the neighbour edges of a node.
      Specified by:
      getNeighbourWeights in interface MultiEdges
      Specified by:
      getNeighbourWeights in interface WeightedMultiEdges
      Parameters:
      node - The node.
      Returns:
      a sream containing all the edge types.
    • addEdge

      public boolean addEdge​(int orig, int dest, double weight, int type)
      Description copied from interface: MultiEdges
      Adds an edge to the set.
      Specified by:
      addEdge in interface MultiEdges
      Parameters:
      orig - Origin node
      dest - Destiny node
      weight - Weight of the edge
      type - Type of the edge
      Returns:
      true if everything went OK, false if not.
    • getNodesWithEdges

      public java.util.stream.IntStream getNodesWithEdges()
      Description copied from interface: MultiEdges
      Obtains the set of nodes which have edges.
      Specified by:
      getNodesWithEdges in interface MultiEdges
      Returns:
      a stream containing the ids of nodes with incident edges
    • removeEdge

      public boolean removeEdge​(int orig, int dest, int idx)
      Description copied from interface: MultiEdges
      Removes an edge.
      Specified by:
      removeEdge in interface MultiEdges
      Parameters:
      orig - source node.
      dest - incoming node.
      idx - the number of the edge
      Returns:
      true if everything went OK, false if not.
    • removeNode

      public boolean removeNode​(int idx)
      Description copied from interface: MultiEdges
      Removes a node from the edge list.
      Specified by:
      removeNode in interface MultiEdges
      Parameters:
      idx - the identifier of the node.
      Returns:
      true if everything went OK, false otherwise.
    • removeEdges

      public boolean removeEdges​(int orig, int dest)
      Description copied from interface: MultiEdges
      Removes all the edges between a pair of nodes.
      Specified by:
      removeEdges in interface MultiEdges
      Parameters:
      orig - source node.
      dest - incoming node.
      Returns:
      true if everything went OK, false otherwise.
    • updateEdgeWeight

      public boolean updateEdgeWeight​(int orig, int dest, double weight, int idx)
      Description copied from interface: MultiEdges
      Modifies the weight of an edge.
      Specified by:
      updateEdgeWeight in interface MultiEdges
      Parameters:
      orig - source node.
      dest - incoming node.
      weight - the new weight of the edge.
      idx - the number of the edge.
      Returns:
      true if everything went OK, false if not, or the edge does not exist.
    • updateEdgeType

      public boolean updateEdgeType​(int orig, int dest, int type, int idx)
      Description copied from interface: MultiEdges
      Modifies the weight of an edge.
      Specified by:
      updateEdgeType in interface MultiEdges
      Parameters:
      orig - source node.
      dest - incoming node.
      type - the new type of the edge.
      idx - the number of the edge.
      Returns:
      true if everything went OK, false if not, or the edge does not exist.