nsl.tools.add_edge
Stay organized with collections
Save and categorize content based on your preferences.
Adds an edge to a given graph.
nsl.tools.add_edge(
graph, edge
)
If an edge between the two nodes already exists, the one with the largest
weight is retained.
Args |
graph
|
A dict : source_id -> (target_id -> weight) to be augmented.
|
edge
|
A list (or tuple ) of the form [source, target, weight] , where
source and target are strings, and weight is a numeric value of
type string or float . The 'weight' component is optional; if not
supplied, it defaults to 1.0.
|
Returns |
True if and only if a new edge was added to graph .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-10-28 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-10-28 UTC."],[],[]]