Class ProcessNode

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

public class ProcessNode extends Object implements Serializable
Represents a node in the process flowsheet graph. Each node corresponds to a ProcessEquipmentInterface unit operation.

This class provides:

  • Unique identification via index and equipment name
  • Tracking of incoming and outgoing edges (stream connections)
  • Graph-neural-network compatible feature vectors
  • Execution state tracking for topological ordering
Version:
1.0
Author:
NeqSim
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • index

      private final int index
      Unique index of this node in the graph.
    • equipment

      private final ProcessEquipmentInterface equipment
      The process equipment this node represents.
    • incomingEdges

      private final List<ProcessEdge> incomingEdges
      Edges representing incoming streams (dependencies).
    • outgoingEdges

      private final List<ProcessEdge> outgoingEdges
      Edges representing outgoing streams (dependents).
    • visited

      private transient boolean visited
      Whether this node has been visited during graph traversal.
    • onStack

      private transient boolean onStack
      Whether this node is currently on the DFS stack (for cycle detection).
    • topologicalOrder

      private transient int topologicalOrder
      Topological sort order (-1 if not yet sorted).
    • sccIndex

      private transient int sccIndex
      Strongly connected component index (-1 if not yet assigned).
  • Constructor Details

    • ProcessNode

      public ProcessNode(int index, ProcessEquipmentInterface equipment)
      Creates a new process node.
      Parameters:
      index - unique index of this node in the graph
      equipment - the process equipment this node represents
  • Method Details

    • getIndex

      public int getIndex()
      Gets the unique index of this node.
      Returns:
      the node index
    • getName

      public String getName()
      Gets the name of the equipment.
      Returns:
      equipment name
    • getEquipment

      public ProcessEquipmentInterface getEquipment()
      Gets the process equipment this node represents.
      Returns:
      the process equipment
    • getEquipmentType

      public String getEquipmentType()
      Gets the equipment type (simple class name).
      Returns:
      the equipment type
    • addIncomingEdge

      void addIncomingEdge(ProcessEdge edge)
      Adds an incoming edge (dependency) to this node.
      Parameters:
      edge - the incoming edge
    • addOutgoingEdge

      void addOutgoingEdge(ProcessEdge edge)
      Adds an outgoing edge (dependent) from this node.
      Parameters:
      edge - the outgoing edge
    • getIncomingEdges

      public List<ProcessEdge> getIncomingEdges()
      Gets all incoming edges (dependencies).
      Returns:
      unmodifiable list of incoming edges
    • getOutgoingEdges

      public List<ProcessEdge> getOutgoingEdges()
      Gets all outgoing edges (dependents).
      Returns:
      unmodifiable list of outgoing edges
    • getInDegree

      public int getInDegree()
      Gets the in-degree (number of incoming edges/dependencies).
      Returns:
      the in-degree
    • getOutDegree

      public int getOutDegree()
      Gets the out-degree (number of outgoing edges/dependents).
      Returns:
      the out-degree
    • isSource

      public boolean isSource()
      Checks if this is a source node (no incoming edges).
      Returns:
      true if this is a source node
    • isSink

      public boolean isSink()
      Checks if this is a sink node (no outgoing edges).
      Returns:
      true if this is a sink node
    • getPredecessors

      public List<ProcessNode> getPredecessors()
      Gets all predecessor nodes (sources of incoming edges).
      Returns:
      list of predecessor nodes
    • getSuccessors

      public List<ProcessNode> getSuccessors()
      Gets all successor nodes (targets of outgoing edges).
      Returns:
      list of successor nodes
    • getFeatureVector

      public double[] getFeatureVector(Map<String,Integer> typeMapping, int numTypes)
      Generates a feature vector for graph neural network compatibility.

      Features include:

      • One-hot encoded equipment type
      • In-degree and out-degree
      • Operating conditions (if available)
      Parameters:
      typeMapping - mapping of equipment types to indices
      numTypes - total number of equipment types
      Returns:
      feature vector
    • isVisited

      boolean isVisited()
    • setVisited

      void setVisited(boolean visited)
    • isOnStack

      boolean isOnStack()
    • setOnStack

      void setOnStack(boolean onStack)
    • getTopologicalOrder

      int getTopologicalOrder()
    • setTopologicalOrder

      void setTopologicalOrder(int order)
    • getSccIndex

      int getSccIndex()
    • setSccIndex

      void setSccIndex(int sccIndex)
    • resetTraversalState

      void resetTraversalState()
      Resets traversal state for a new graph analysis.
    • 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