Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
nodeid = self._node or Plotter._defaultNodeId
sources = elist[self._source]
dests = elist[self._destination]
elist.drop([self._source, self._destination], axis=1, inplace=True)
# Filter out nodes which have no edges
lnodes = pandas.concat([sources, dests], ignore_index=True).unique()
lnodes_df = pandas.DataFrame(lnodes, columns=[nodeid])
filtered_nlist = pandas.merge(lnodes_df, nlist, on=nodeid, how='left')
# Create a map from nodeId to a continuous range of integer [0, #nodes-1].
# The vgraph protobuf format uses the continous integer ranger as internal nodeIds.
node_map = dict([(v, i) for i, v in enumerate(lnodes.tolist())])
dataset = vgraph.create(elist, filtered_nlist, sources, dests, nodeid, node_map, name)
dataset['encodings'] = encodings
return dataset