Access the edge at the given index.
Whether this collection is empty.
The number of edges in this collection.
The source nodes connected to the edges in this collection.
The target nodes connected to the edges in this collection.
Checks if all edges in this collection are compatible with a specific type. This is effectively a type guard function.
Whether the edge is compatible with the given type.
Changes the functionality class of the edges. This is only possible if the data and scratch data are compatible with the new class.
This is analogous to BaseEdge.Class.as but for a collection of edges.
The same collection, with the new functionality class.
Performs a diff comparison between this collection and another collection. You can think of the result as the added, removed, and kept elements to go from this collection to the other collection.
The other collection to compare with.
An object with three properties:
both
: A collection with the edges that are in both collections. The type
of this collection is maintained.onlyLeft
: A collection with the edges that are only in this collection. The
type of this collection is maintained.onlyRight
: A collection with the edges that are only in the other collection.
The type of the other collection is maintained.The complement of this collection with respect to the universe of all edges in the graph.
Returns whether the collection contains any of the edges in the given collection.
The collection to check for.
Whether the collection contains any of the edges in the given collection.
Returns the set difference of this collection with another collection. You may chain this method to remove multiple collections.
A new collection that consists of the edges in this collection that are not in the other collection.
Returns whether all edges in the collection satisfy the provided function. Returns true for an empty collection.
Whether all edges in the collection satisfy the function.
Returns whether all edges in the collection satisfy the provided function. Returns true for an empty collection.
The function to test each edge. ele - The current element, i - The index of the current element, eles - The collection of elements being iterated.
The value to use as this
when executing the function.
Whether all edges in the collection satisfy the function.
Changes the functionality class of the edges. Should only be used when it is known (but not statically provable) that all edges are compatible with the new class. If not, an error will be thrown.
It is bad practice to try and catch the error thrown by this function. For such cases, combine EdgeCollection.allAre with EdgeCollection.allAs.
The edge collection, wrapped in the new functionality class.
LaraFlowError if any edge is not compatible with the type. This error should be seen as a logic error and not catched.
Returns a new collection containing only the edges that satisfy the provided function.
A new collection containing only the edges that satisfy the function.
Returns a new collection containing only the edges that satisfy the provided function.
The function to test each edge. ele - The current element, i - The index of the current element, eles - The collection of elements being iterated.
The value to use as this
when executing the function.
A new collection containing only the edges that satisfy the function.
Executes the provided function once for each edge in the collection.
Unline the analogous cytoscape method, this method does not support
exiting early by returning false, due to the fact that a return false;
would not be clear and intuitive for someone reading the code. As such,
this function follows the behavior of the Array.prototype.forEach method.
In the future, if that feature is really desirable, instead of returning false, the function could return an enum value that represents a control flow instruction. Until then, a for loop may be used.
Executes the provided function once for each edge in the collection.
Unline the analogous cytoscape method, this method does not support
exiting early by returning false, due to the fact that a return false;
would not be clear and intuitive for someone reading the code. As such,
this function follows the behavior of the Array.prototype.forEach method.
In the future, if that feature is really desirable, instead of returning false, the function could return an enum value that represents a control flow instruction. Until then, a for loop may be used.
The function to execute for each edge. ele - The current element, i - The index of the current element, eles - The collection of elements being iterated.
The value to use as this
when executing the function.
Returns the intersection of this collection with another collection. You may chain this method to intersect multiple collections.
A new collection containing the intersection of all edges.
Find the maximum value in a collection.
An object with the maximum element and its value, or undefined if the collection is empty.
Find the maximum value in a collection.
The function that returns the value to compare. ele - The current element, i - The index of the current element, eles - The collection of elements being iterated.
The value to use as this
when executing the function.
An object with the maximum element and its value, or undefined if the collection is empty.
Find the minimum value in a collection.
An object with the minimum element and its value, or undefined if the collection is empty.
Find the minimum value in a collection.
The function that returns the value to compare. ele - The current element, i - The index of the current element, eles - The collection of elements being iterated.
The value to use as this
when executing the function.
An object with the minimum element and its value, or undefined if the collection is empty.
Returns whether the elements in the collection are the same as the elements in the other collection.
The other collection to compare with.
Whether the elements in the collection are the same as the elements in the other collection.
Get a subset of the elements in the collection based on specified indices.
Optional
start: numberAn integer that specifies where to start the selection. If omitted, the first element, with an index of 0, will be selected. Use negative numbers to select from the end of an array.
Optional
end: numberAn integer that specifies where to end the selection. If omitted, all elements from the start position and to the end of the array will be selected. Use negative numbers to select from the end of an array.
A new collection containing the selected elements.
Returns whether any edge in the collection satisfies the provided function. Returns false for an empty collection.
Whether any edge in the collection satisfies the function.
Returns whether any edge in the collection satisfies the provided function. Returns false for an empty collection.
The function to test each edge. ele - The current element, i - The index of the current element, eles - The collection of elements being iterated.
The value to use as this
when executing the function.
Whether any edge in the collection satisfies the function.
Returns a collection with the elements sorted according to the given comparison function.
Regarding the return value of the comparison function:
A new collection with the elements sorted.
Returns the symmetric difference of this collection with another collection. This collection consists of the edges that are in either collection, but not in both.
If the rhs collection is a subtype of the lhs collection, the resulting collection will have the lhs type.
A new collection containing the symmetric difference of the two collections.
LaraFlowError if the other collection is from a different graph.
Returns the symmetric difference of this collection with another collection. This collection consists of the edges that are in either collection, but not in both.
If the rhs collection is not a subtype of the lhs collection, the resulting collection will be downgraded to a BaseEdge and must be casted to the desired type explicitly with EdgeCollection.allAs.
A new collection containing the symmetric difference of the two collections.
LaraFlowError if the other collection is from a different graph.
Returns the union of this collection with another collection. You may chain this method to union multiple collections.
If the rhs collection is a subtype of the lhs collection, the resulting collection will have the lhs type.
A new collection containing the union of all edges.
LaraFlowError if the other collection is from a different graph.
Returns the union of this collection with another collection. You may chain this method to union multiple collections.
If the rhs collection is not a subtype of the lhs collection, the resulting collection will be downgraded to a BaseEdge and must be casted to the desired type explicitly with EdgeCollection.allAs.
A new collection containing the union of all edges.
LaraFlowError if the other collection is from a different graph.
Static
fromCreates a new collection from the given edges. At least one edge must be provided. For an empty collection, use BaseGraph.Class.emptyCollection.
A new collection containing the given edges.
Static
fromCreates a new collection from the given cytoscape collection.
The cytoscape collection to create the collection from.
A new collection containing the edges from the cytoscape collection.
A collection of edges from a given graph. All edges have a common edge type. If the edges can be of any edge type, the common type is BaseEdge.