资源简介
安装文件:
1.python-2.7.3.msi
2.pywin32-214.win32-py2.7.exe
3.numpy-1.6.2.win32-py2.7.exe
4.matplotlib-1.1.0.win32-py2.7.exe
5.setuptools-0.6c11.win32-py2.7.exe
6.networkx-1.7rc1-py2.7.egg
代码片段和文件信息
“““
This module provides functions to convert
NetworkX graphs to and from other formats.
The preferred way of converting data to a NetworkX graph
is through the graph constuctor. The constructor calls
the to_networkx_graph() function which attempts to guess the
input type and convert it automatically.
Examples
--------
Create a 10 node random graph from a numpy matrix
>>> import numpy
>>> a=numpy.reshape(numpy.random.random_integers(01size=100)(1010))
>>> D=nx.DiGraph(a)
or equivalently
>>> D=nx.to_networkx_graph(acreate_using=nx.DiGraph())
Create a graph with a single edge from a dictionary of dictionaries
>>> d={0: {1: 1}} # dict-of-dicts single edge (01)
>>> G=nx.Graph(d)
See Also
--------
nx_pygraphviz nx_pydot
“““
__author__ = “““\n“““.join([‘Aric Hagberg (hagberg@lanl.gov)‘
‘Pieter Swart (swart@lanl.gov)‘
‘Dan Schult(dschult@colgate.edu)‘])
# Copyright (C) 2006-2011 by
# Aric Hagberg
# Dan Schult
# Pieter Swart
# All rights reserved.
# BSD license.
import warnings
import networkx as nx
__all__ = [‘to_networkx_graph‘
‘from_dict_of_dicts‘ ‘to_dict_of_dicts‘
‘from_dict_of_lists‘ ‘to_dict_of_lists‘
‘from_edgelist‘ ‘to_edgelist‘
‘from_numpy_matrix‘ ‘to_numpy_matrix‘
‘to_numpy_recarray‘
‘from_scipy_sparse_matrix‘ ‘to_scipy_sparse_matrix‘]
def _prep_create_using(create_using):
“““Return a graph object ready to be populated.
If create_using is None return the default (just networkx.Graph())
If create_using.clear() works assume it returns a graph object.
Otherwise raise an exception because create_using is not a networkx graph.
“““
if create_using is None:
G=nx.Graph()
else:
G=create_using
try:
G.clear()
except:
raise TypeError(“Input graph is not a networkx graph type“)
return G
def to_networkx_graph(datacreate_using=Nonemultigraph_input=False):
“““Make a NetworkX 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 (01)
>>> G=nx.Graph(d)
instead of the equivalent
>>> G=nx.from_dict_of_dicts(d)
Parameters
----------
data : a object to be converted
Current known types are:
any NetworkX graph
dict-of-dicts
dist-of-lists
list of edges
numpy matrix
numpy ndarray
scipy sparse matrix
pygraphviz agraph
create_using : NetworkX graph
Use specified graph for result. Otherwise a new graph is created.
multigraph_input : bool (default False)
If True and data is a dict_of_dicts
try to create a multigraph assuming dict_of_dict_of_lists.
If data and create_using are bo
相关资源
- python深度学习-高清pdf-源码
- 嵩天 礼欣 黄天羽 著 Python语言程序
- Python3.8.0 官方中文帮助文档 API参考手
- Introduction to Computation and Programming Us
- 亚马逊电子书-Keras快速上手:基于P
- ROS系统上的python应用开发实践讲解与
- python 数据挖掘入门与实战 pdf+代码
- Python3.4 PyQt5 32位安装版PyQt5-5.5.1-gpl-
- 基于python3 tensorflow DBN_and_RNN的实现
- Fluent Python高清中文版
- python计算机视觉编程programming compute
- python调用dlib库实现简单的人脸识别
- Python-全唐诗分析程序
- Python-我是小诗姬全唐诗作为训练数据
- 基于python和pencv的车牌号码识别
- Python实现的GMM用于语音识别
- python+selenium+unittest自动化测试demo
- Django可用的安装包
- Python for Kids - A Playful Introduction to Pr
- scipy-1.4.1-cp38-cp38-win_amd64.whl
- Python+selenium+HTMLTestRunner+unittest 测试框
- Python做一个推箱子小游戏
- python学习手册中文版.epub
- python预测分析核心算法含大量代码
- python智能垃圾分类串口控制arduino.zi
- python实现kaggle中的数字识别
- ArcGIS平台中的Python开发
- Python编程案例教程
- 最新Python离线帮助文档PDF格式-Python
- 用Python写网络爬虫PDF&源码.rar
评论
共有 条评论