Class ProcessNode
java.lang.Object
neqsim.process.processmodel.graph.ProcessNode
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final ProcessEquipmentInterfaceThe process equipment this node represents.private final List<ProcessEdge> Edges representing incoming streams (dependencies).private final intUnique index of this node in the graph.private booleanWhether this node is currently on the DFS stack (for cycle detection).private final List<ProcessEdge> Edges representing outgoing streams (dependents).private intStrongly connected component index (-1 if not yet assigned).private static final longprivate intTopological sort order (-1 if not yet sorted).private booleanWhether this node has been visited during graph traversal. -
Constructor Summary
ConstructorsConstructorDescriptionProcessNode(int index, ProcessEquipmentInterface equipment) Creates a new process node. -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddIncomingEdge(ProcessEdge edge) Adds an incoming edge (dependency) to this node.(package private) voidaddOutgoingEdge(ProcessEdge edge) Adds an outgoing edge (dependent) from this node.booleanGets the process equipment this node represents.Gets the equipment type (simple class name).double[]getFeatureVector(Map<String, Integer> typeMapping, int numTypes) Generates a feature vector for graph neural network compatibility.Gets all incoming edges (dependencies).intGets the in-degree (number of incoming edges/dependencies).intgetIndex()Gets the unique index of this node.getName()Gets the name of the equipment.intGets the out-degree (number of outgoing edges/dependents).Gets all outgoing edges (dependents).Gets all predecessor nodes (sources of incoming edges).(package private) intGets all successor nodes (targets of outgoing edges).(package private) intinthashCode()(package private) booleanbooleanisSink()Checks if this is a sink node (no outgoing edges).booleanisSource()Checks if this is a source node (no incoming edges).(package private) boolean(package private) voidResets traversal state for a new graph analysis.(package private) voidsetOnStack(boolean onStack) (package private) voidsetSccIndex(int sccIndex) (package private) voidsetTopologicalOrder(int order) (package private) voidsetVisited(boolean visited) toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
index
private final int indexUnique index of this node in the graph. -
equipment
The process equipment this node represents. -
incomingEdges
Edges representing incoming streams (dependencies). -
outgoingEdges
Edges representing outgoing streams (dependents). -
visited
private transient boolean visitedWhether this node has been visited during graph traversal. -
onStack
private transient boolean onStackWhether this node is currently on the DFS stack (for cycle detection). -
topologicalOrder
private transient int topologicalOrderTopological sort order (-1 if not yet sorted). -
sccIndex
private transient int sccIndexStrongly connected component index (-1 if not yet assigned).
-
-
Constructor Details
-
ProcessNode
Creates a new process node.- Parameters:
index- unique index of this node in the graphequipment- the process equipment this node represents
-
-
Method Details
-
getIndex
public int getIndex()Gets the unique index of this node.- Returns:
- the node index
-
getName
-
getEquipment
Gets the process equipment this node represents.- Returns:
- the process equipment
-
getEquipmentType
Gets the equipment type (simple class name).- Returns:
- the equipment type
-
addIncomingEdge
Adds an incoming edge (dependency) to this node.- Parameters:
edge- the incoming edge
-
addOutgoingEdge
Adds an outgoing edge (dependent) from this node.- Parameters:
edge- the outgoing edge
-
getIncomingEdges
Gets all incoming edges (dependencies).- Returns:
- unmodifiable list of incoming edges
-
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
Gets all predecessor nodes (sources of incoming edges).- Returns:
- list of predecessor nodes
-
getSuccessors
Gets all successor nodes (targets of outgoing edges).- Returns:
- list of successor nodes
-
getFeatureVector
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 indicesnumTypes- 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
-
equals
-
hashCode
-