001package org.biopax.paxtools.query.model;
002
003import java.util.Collection;
004
005/**
006 * Node interface to use in graph algorithms.
007 *
008 * @author Ozgun Babur
009 */
010public interface Node extends GraphObject
011{
012        /**
013         * @return Upstream edges
014         */
015        Collection<Edge> getUpstream();
016
017        /**
018         * @return Downstream edges
019         */
020        Collection<Edge> getDownstream();
021
022        /**
023         * This method is critical when the algorithm needs to calculate a path length. A graph may
024         * contain nodes that will not add to the path length. Such nodes are not breadth node. So the
025         * length of the path is the number of breadth nodes - 1.
026         *
027         * @return Whether this is a breadth node
028         */
029        boolean isBreadthNode();
030
031        /**
032         * @return Parent equivalent nodes
033         */
034        Collection<Node> getUpperEquivalent();
035
036        /**
037         * @return Child equivalent nodes
038         */
039        Collection<Node> getLowerEquivalent();
040
041        /**
042         * Some nodes can have a sign (typically non-breadth nodes).
043         * @return Sign of the node
044         */
045        int getSign();
046
047        /**
048         * In biological graphs, some nodes are used ubiquitously like ATP, H2O, etc. While traversing a
049         * graph we do not want these molecules to link two reactions. So they should be labeled.
050         * @return Whether this note is a ubiquitous node.
051         */
052        boolean isUbique();
053
054        /**
055         * A node may be related to a transcription and an algorithm can depend on this information.
056         * @return Whether this node is related to a transcription event
057         */
058        boolean isTranscription();
059
060        /**
061         * Initializes the node.
062         */
063        void init();
064
065        /**
066         * Positive sign. This is not an Enum because we want to be able calculate sign of a path by
067         * multiplying signs of path elements.
068         */
069        public static final int POSITIVE = 1;
070
071        /**
072         * Negative sign. This is not an Enum because we want to be able calculate sign of a path by
073         * multiplying signs of path elements.
074         */
075        public static final int NEGATIVE = -1;
076
077        /**
078         * Neutral sign. This is not an Enum because we want to be able calculate sign of a path by
079         * multiplying signs of path elements.
080         */
081        public static final int NEUTRAL = 0;
082}