Update the logic of edge attribute generation #521
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, edge attribute is generated based on whether
colnames(edges_df)[j]
is in selected attributes and the content for current edgeedges_df[i, j]
is valid.The checks on
edges_df[i, j]
is whether it isNA
or not empty string. But this logic is not closed sinceedges_df[i, j]
can be empty string (''). This is possible since in previous code ingenerate_dot()
, empty attributes have been set to empty string, not NA. This will lead to some bad behavior:If the 1st edge does not have attributes set, this function will throw a "object 'attribute' not found" error. Rendering issue in PowerBI #440
If the previous edge has some attributes set while latters don't, then the previous attributes will be carried over to latter edges since
attribute
is not properly set toNULL
at the beginning for each edge. e.g.This patch adds a new check for
edges_df[i, j]
being empty string to fix this loop hole.