Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is a possible algorithm to select only the nodes with angle brackets at the outer edges:

  1. Scan the input graph and, for each node, check if it has any incoming or outgoing edges.
  2. For nodes with no incoming or outgoing edges, check if their label (if any) starts and ends with angle brackets ("<" and ">"). If so, mark them as "outer" nodes.
  3. For all other nodes with incoming or outgoing edges, mark them as "inner" nodes.
  4. Return the set of "outer" nodes.

Note: This algorithm assumes that the input graph is a directed graph, where edges have a direction (from a source node to a target node). If the graph is undirected, some modifications may be necessary.