Class ProcessEdge

java.lang.Object
neqsim.process.processmodel.graph.ProcessEdge
All Implemented Interfaces:
Serializable

public class ProcessEdge extends Object implements Serializable
Represents a directed edge in the process flowsheet graph. Each edge corresponds to a stream connection between two equipment units.

This class provides:

  • Source and target node references
  • Optional reference to the underlying StreamInterface
  • Edge type classification (material, energy, signal)
  • Graph-neural-network compatible edge features
Version:
1.0
Author:
NeqSim
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • source

      private final ProcessNode source
      The source node (upstream equipment).
    • target

      private final ProcessNode target
      The target node (downstream equipment).
    • stream

      private final StreamInterface stream
      The stream this edge represents (may be null for control signals).
    • name

      private final String name
      Name of this edge/stream.
    • edgeType

      private final ProcessEdge.EdgeType edgeType
      Type of this edge.
    • index

      private final int index
      Unique index of this edge in the graph.
    • isBackEdge

      private transient boolean isBackEdge
      Whether this edge is part of a cycle (back edge in DFS).
  • Constructor Details

    • ProcessEdge

      public ProcessEdge(int index, ProcessNode source, ProcessNode target, StreamInterface stream, String name, ProcessEdge.EdgeType edgeType)
      Creates a new process edge.
      Parameters:
      index - unique index of this edge
      source - source node
      target - target node
      stream - the stream this edge represents (may be null)
      name - edge name
      edgeType - type of edge
    • ProcessEdge

      public ProcessEdge(int index, ProcessNode source, ProcessNode target, StreamInterface stream)
      Creates a material edge with automatic type detection.
      Parameters:
      index - unique index
      source - source node
      target - target node
      stream - the stream
    • ProcessEdge

      public ProcessEdge(int index, ProcessNode source, ProcessNode target, String name, ProcessEdge.EdgeType edgeType)
      Creates an edge without a stream (e.g., control signal).
      Parameters:
      index - unique index
      source - source node
      target - target node
      name - edge name
      edgeType - type of edge
  • Method Details

    • generateName

      private String generateName()
    • detectEdgeType

      private static ProcessEdge.EdgeType detectEdgeType(StreamInterface stream, ProcessNode source, ProcessNode target)
    • getIndex

      public int getIndex()
      Gets the unique index of this edge.
      Returns:
      the edge index
    • getSource

      public ProcessNode getSource()
      Gets the source node.
      Returns:
      source node
    • getTarget

      public ProcessNode getTarget()
      Gets the target node.
      Returns:
      target node
    • getStream

      public StreamInterface getStream()
      Gets the stream this edge represents.
      Returns:
      the stream, or null if this is not a stream connection
    • getName

      public String getName()
      Gets the edge name.
      Returns:
      edge name
    • getEdgeType

      public ProcessEdge.EdgeType getEdgeType()
      Gets the edge type.
      Returns:
      edge type
    • isRecycle

      public boolean isRecycle()
      Checks if this edge is a recycle edge.
      Returns:
      true if this is a recycle edge
    • isBackEdge

      public boolean isBackEdge()
      Checks if this edge is a back edge (creates a cycle in the graph).
      Returns:
      true if this is a back edge
    • setBackEdge

      void setBackEdge(boolean isBackEdge)
      Sets whether this edge is a back edge.
      Parameters:
      isBackEdge - true if this is a back edge
    • getSourceIndex

      public int getSourceIndex()
      Gets the source node index.
      Returns:
      source node index
    • getTargetIndex

      public int getTargetIndex()
      Gets the target node index.
      Returns:
      target node index
    • getFeatureVector

      public double[] getFeatureVector()
      Generates edge feature vector for GNN compatibility.

      Features include:

      • One-hot encoded edge type
      • Stream properties (temperature, pressure, flow rate)
      • Back edge indicator
      Returns:
      feature vector
    • getIndexPair

      public int[] getIndexPair()
      Gets edge as index pair [source, target] for sparse graph representation.
      Returns:
      array with [sourceIndex, targetIndex]
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object