( graph: Graph<N, E, T> | MutableGraph<N, E, T>, nodeIndex: NodeIndex, direction: TraversalDirection )
| 3748 | } |
| 3749 | |
| 3750 | const getTraversalNeighbors = <N, E, T extends Kind>( |
| 3751 | graph: Graph<N, E, T> | MutableGraph<N, E, T>, |
| 3752 | nodeIndex: NodeIndex, |
| 3753 | direction: TraversalDirection |
| 3754 | ): Array<NodeIndex> => { |
| 3755 | if (graph.type === "undirected") { |
| 3756 | return getUndirectedNeighbors(graph as any, nodeIndex) |
| 3757 | } |
| 3758 | const directed = graph as Graph<N, E, "directed"> | MutableGraph<N, E, "directed"> |
| 3759 | if (direction !== "undirected") { |
| 3760 | return getDirectedNeighbors(directed, nodeIndex, direction) |
| 3761 | } |
| 3762 | const neighbors = new Set(getDirectedNeighbors(directed, nodeIndex, "outgoing")) |
| 3763 | for (const neighbor of getDirectedNeighbors(directed, nodeIndex, "incoming")) { |
| 3764 | neighbors.add(neighbor) |
| 3765 | } |
| 3766 | return Array.from(neighbors) |
| 3767 | } |
| 3768 | |
| 3769 | const getTraversableNeighbor = <N, E, T extends Kind>( |
| 3770 | graph: Graph<N, E, T> | MutableGraph<N, E, T>, |
no test coverage detected