Ask Your Question
2

What is the algorithm to select only the nodes with angle brackets at the outer edges?

asked 2023-06-28 02:05:59 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-06-28 02:16:01 +0000

djk gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-28 02:05:59 +0000

Seen: 14 times

Last updated: Jun 28 '23