#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import networkx.generators.small from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.generators.small)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import networkx.utils.decorators from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.utils.decorators)
import networkx.algorithms.assortativity.tests.test_neighbor_degree import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.assortativity.tests.test_neighbor_degree, decorators=pytest.mark.usefixtures("graphscope_session"))
import networkx.algorithms.link_analysis.tests.test_hits import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.link_analysis.tests.test_hits, decorators=pytest.mark.usefixtures("graphscope_session"))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import networkx.generators.line from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.generators.line)
import networkx.algorithms.shortest_paths.tests.test_generic import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.shortest_paths.tests.test_generic, decorators=pytest.mark.usefixtures("graphscope_session"))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import networkx.generators.degree_seq from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.generators.degree_seq)
# This file is part of NetworkX. # # NetworkX is distributed under a BSD license; see LICENSE.txt for more # information. # import networkx.readwrite.edgelist from networkx.readwrite.edgelist import parse_edgelist as _parse_edgelist from networkx.readwrite.edgelist import read_edgelist as _read_edgelist from networkx.utils.decorators import open_file from graphscope.experimental import nx from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx from graphscope.experimental.nx.utils.compat import patch_docstring import_as_graphscope_nx(networkx.readwrite.edgelist) @patch_docstring(_parse_edgelist) def parse_edgelist( lines, comments="#", delimiter=None, create_using=None, nodetype=None, data=True ): from ast import literal_eval G = nx.empty_graph(0, create_using) edges = [] for line in lines: p = line.find(comments) if p >= 0: line = line[:p] if not len(line):
import networkx.algorithms.node_classification.tests.test_harmonic_function import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.node_classification.tests.test_harmonic_function, decorators=pytest.mark.usefixtures("graphscope_session"))
import networkx.algorithms.components.tests.test_semiconnected import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx from graphscope.experimental.nx.utils.compat import with_graphscope_nx_context import_as_graphscope_nx( networkx.algorithms.components.tests.test_semiconnected, decorators=pytest.mark.usefixtures("graphscope_session")) from networkx.algorithms.components.tests.test_semiconnected import TestIsSemiconnected @pytest.mark.usefixtures("graphscope_session") @with_graphscope_nx_context(TestIsSemiconnected) class TestIsSemiconnected(): def test_undirected(self): pytest.raises(nx.NetworkXNotImplemented, nx.is_semiconnected, nx.Graph()) def test_empty(self): pytest.raises(nx.NetworkXPointlessConcept, nx.is_semiconnected, nx.DiGraph())
import networkx.algorithms.node_classification.tests.test_local_and_global_consistency import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.node_classification.tests. test_local_and_global_consistency, decorators=pytest.mark.usefixtures("graphscope_session"))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # """ GraphScope's compatible layer for :mod:`networkx.relabel`. """ import networkx.relabel from graphscope.experimental import nx from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.relabel)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import networkx.generators.community from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.generators.community)
import networkx.algorithms.centrality.tests.test_dispersion import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.centrality.tests.test_dispersion, decorators=pytest.mark.usefixtures("graphscope_session"))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import networkx.utils.misc from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.utils.misc)
import networkx.algorithms.tests.test_distance_regular import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.tests.test_distance_regular, decorators=pytest.mark.usefixtures("graphscope_session"))
import networkx.algorithms.centrality.tests.test_current_flow_betweenness_centrality_subset import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.centrality.tests. test_current_flow_betweenness_centrality_subset, decorators=pytest.mark.usefixtures("graphscope_session"))
import networkx.algorithms.approximation.tests.test_treewidth import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.algorithms.approximation.tests.test_treewidth, decorators=pytest.mark.usefixtures("graphscope_session"))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import networkx.generators.trees from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.generators.trees)
import networkx.algorithms.community.tests.test_quality import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.community.tests.test_quality, decorators=pytest.mark.usefixtures("graphscope_session"))
import networkx.algorithms.isomorphism.tests.test_temporalisomorphvf2 import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.isomorphism.tests.test_temporalisomorphvf2, decorators=pytest.mark.usefixtures("graphscope_session")) @pytest.mark.skip(reason="not supoort time object as attribute") class TestTimeRespectingGraphMatcher(object): pass @pytest.mark.skip(reason="not supoort time object as attribute") class TestDiTimeRespectingGraphMatcher(object): pass
# NetworkX is distributed under a BSD license; see LICENSE.txt for more # information. # import warnings import networkx.convert from networkx.convert import from_dict_of_dicts from networkx.convert import from_dict_of_lists from networkx.convert import from_edgelist from graphscope.experimental import nx from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx from graphscope.framework.dag_utils import arrow_to_dynamic import_as_graphscope_nx(networkx.convert) def to_nx_graph(data, create_using=None, multigraph_input=False): # noqa: C901 """Make a graph from a known data structure. The preferred way to call this is automatically from the class constructor >>> d = {0: {1: {'weight':1}}} # dict-of-dicts single edge (0,1) >>> G = nx.Graph(d) instead of the equivalent >>> G = nx.from_dict_of_dicts(d)
import networkx.algorithms.flow.tests.test_maxflow_large_graph import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx from graphscope.experimental.nx.utils.compat import with_graphscope_nx_context import_as_graphscope_nx( networkx.algorithms.flow.tests.test_maxflow_large_graph, decorators=pytest.mark.usefixtures("graphscope_session")) from networkx.algorithms.flow.tests.test_maxflow_large_graph import \ TestMaxflowLargeGraph @pytest.mark.usefixtures("graphscope_session") @with_graphscope_nx_context(TestMaxflowLargeGraph) class TestMaxflowLargeGraph(): @pytest.mark.skip(reason="not support tuple as node") def test_pyramid(self): pass @pytest.mark.skip(reason="not support read_gpickle") def test_gl1(self): pass @pytest.mark.skip(reason="not support read_gpickle") def test_gw1(self): pass @pytest.mark.skip(reason="not support read_gpickle") def test_wlm3(self):
import networkx.algorithms.tests.test_minors import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.algorithms.tests.test_minors, decorators=pytest.mark.usefixtures("graphscope_session")) @pytest.mark.skip(reason="not support Graph object as node.") class TestQuotient(object): pass @pytest.mark.skip(reason="not support Graph object as node.") class TestContraction(object): pass
import networkx.algorithms.bipartite.tests.test_centrality import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.bipartite.tests.test_centrality, decorators=pytest.mark.usefixtures("graphscope_session"))
import networkx.algorithms.traversal.tests.test_beamsearch import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx( networkx.algorithms.traversal.tests.test_beamsearch, decorators=pytest.mark.usefixtures("graphscope_session"))
# All rights reserved. # # This file is part of NetworkX. # # NetworkX is distributed under a BSD license; see LICENSE.txt for more # information. # import networkx.convert_matrix from networkx.convert_matrix import from_pandas_edgelist as _from_pandas_edgelist from graphscope.experimental import nx from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx from graphscope.experimental.nx.utils.compat import patch_docstring import_as_graphscope_nx(networkx.convert_matrix) @patch_docstring(_from_pandas_edgelist) def from_pandas_edgelist(df, source="source", target="target", edge_attr=None, create_using=None): g = nx.empty_graph(0, create_using) if edge_attr is None: g.add_edges_from(zip(df[source], df[target])) return g # Additional columns requested