diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-09-02 20:19:03 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-09-02 20:19:03 +0000 |
| commit | 7a6ded40965d341456cdd5882c61ca4e22913c2b (patch) | |
| tree | 2d4a47844399f710a6754d85c35f87ad45ac4200 /lib/graph.c | |
| parent | 16d7c05093f0f3a24d09f9780afc1ea114e73f94 (diff) | |
lib: Refactor command_parse.y for graph ds
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/graph.c')
| -rw-r--r-- | lib/graph.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/graph.c b/lib/graph.c index a46f71449d..891851b301 100644 --- a/lib/graph.c +++ b/lib/graph.c @@ -59,8 +59,10 @@ graph_delete_node (struct graph *graph, struct graph_node *node) vector_unset (adj->to, j); // if the node is orphaned, delete it - if (vector_active (adj->to) == 0 && vector_active (adj->from) == 0) - graph_delete_node (adj); + if (vector_active (adj->to) == 0 && + vector_active (adj->from) == 0 && + adj != node) + graph_delete_node (adj); } // for all nodes that we have an edge to, remove us from their ->from @@ -72,8 +74,10 @@ graph_delete_node (struct graph *graph, struct graph_node *node) vector_unset (adj->from, j); // if the node is orphaned, delete it - if (vector_active (adj->to) == 0 && vector_active (adj->from) == 0) - graph_delete_node (adj); + if (vector_active (adj->to) == 0 && + vector_active (adj->from) == 0 && + adj != node) + graph_delete_node (adj); } // if there is a deletion callback, call it! |
