MCPcopy
hub / github.com/dmlc/dgl / create_from_edges

Function create_from_edges

python/dgl/convert.py:1990–2066  ·  view source on GitHub ↗

Internal function to create a graph from incident nodes with types. utype could be equal to vtype Parameters ---------- sparse_fmt : str The sparse adjacency matrix format. arrays : tuple[Tensor] The sparse adjacency matrix arrays. utype : str Source

(
    sparse_fmt,
    arrays,
    utype,
    etype,
    vtype,
    urange,
    vrange,
    row_sorted=False,
    col_sorted=False,
)

Source from the content-addressed store, hash-verified

1988
1989
1990def create_from_edges(
1991 sparse_fmt,
1992 arrays,
1993 utype,
1994 etype,
1995 vtype,
1996 urange,
1997 vrange,
1998 row_sorted=False,
1999 col_sorted=False,
2000):
2001 """Internal function to create a graph from incident nodes with types.
2002
2003 utype could be equal to vtype
2004
2005 Parameters
2006 ----------
2007 sparse_fmt : str
2008 The sparse adjacency matrix format.
2009 arrays : tuple[Tensor]
2010 The sparse adjacency matrix arrays.
2011 utype : str
2012 Source node type name.
2013 etype : str
2014 Edge type name.
2015 vtype : str
2016 Destination node type name.
2017 urange : int, optional
2018 The source node ID range. If None, the value is the maximum
2019 of the source node IDs in the edge list plus 1. (Default: None)
2020 vrange : int, optional
2021 The destination node ID range. If None, the value is the
2022 maximum of the destination node IDs in the edge list plus 1. (Default: None)
2023 row_sorted : bool, optional
2024 Whether or not the rows of the COO are in ascending order.
2025 col_sorted : bool, optional
2026 Whether or not the columns of the COO are in ascending order within
2027 each row. This only has an effect when ``row_sorted`` is True.
2028
2029
2030 Returns
2031 -------
2032 DGLGraph
2033 """
2034 if utype == vtype:
2035 num_ntypes = 1
2036 else:
2037 num_ntypes = 2
2038
2039 if sparse_fmt == "coo":
2040 u, v = arrays
2041 hgidx = heterograph_index.create_unitgraph_from_coo(
2042 num_ntypes,
2043 urange,
2044 vrange,
2045 u,
2046 v,
2047 ["coo", "csr", "csc"],

Callers 7

graphFunction · 0.85
heterographFunction · 0.85
create_blockFunction · 0.85
from_scipyFunction · 0.85
bipartite_from_scipyFunction · 0.85
from_networkxFunction · 0.85
bipartite_from_networkxFunction · 0.85

Calls 1

DGLGraphClass · 0.85

Tested by

no test coverage detected