创建图形数据结构
graphqt的Python项目详细描述
作者:amit singh sansoya(@amit3200) Github:https://github.com/Amit3200 库:graphqt
#导入
`import graphqt`
#介绍 这是python的测试库,允许您使用一些函数创建图形这个库将允许您创建无向图,并提供一些其他功能。这个库是为初学者程序员谁想开始与图形编程,并希望它容易可视化。强烈建议您学习实际的代码,以便在面试和竞争中不使用此库就可以实现它们这个库是为目前正在学习图形的程序员设计的这将使他们有想法和暴力解决方案,他们可以进一步优化。这本书还允许你做以下事情
- 创建图形[无向]
- 探测周期[无向]
- 检查路径[无方向]
- 断开的组件[无方向]
#创建图形
### Description:
This function allow you to add the edge between two nodes. The use of this function is very simple. One only needs to pass the dictionary so called graph,node u and node v where edge will exist between u and v. Moreover the edge v and u will be automatically created as this is undirected graph.
Function Use : insertuv(dictionary_name,node1,node2) Example : graphqt.insert_uv(d,1,2) Return Type : None In above example d is the dictionary (so called graph)
#检测周期
### Description:
As the name suggests, this function will allow you to detect if there is a cycle in graph Return type is Boolean [True or False] where True tells that graph has cycle and False depicts there is no cycle. This will detect as per the undirected graph.
Function use : detect_cycle(dictionary_name) Example : graphqt.detect_cycle(d) Return Type : Boolean In above example d is the dictionary (so called graph)
#检查路径
### Description:
As the name says this function will tell you if there exists the path between two nodes. One only needs to pass dictionary_name (so called graph), the node u and node v. This function returns boolean value. True if there is path between u and v else False
Function use : check_path(dictionary_name,node1,node2) Example : graphqt.check_path(d,2,8) Return Type : Boolean In above example d is the dictionary (so called graph)
#断开的部件
### Description:
As the name says this function will detect the disconnected components and this will return a dictionary having keys as: ‘dis_count’: This will give you the values of count of disconnected components in a graph. If the value returned is 1 then there is no disconnected component. [ Makes Sense ;) ] ‘components’: Gives the list of containing nodes which are connected together
Function use : graphqt.get_disconnected_components(d) graphqt.get_disconnected_components(d)[‘dis_count’] graphqt.get_disconnected_components(d)[‘components’] Return Type : Dict
#注
记住
这个库类似于无向图 同时获得非常重要的函数后面的逻辑
#支持作者: ###阿米特·辛格·桑索亚(@amit3200) ###github:https://github.com/Amit3200
##保持编码和微笑