我有一个networkx图形对象G。每个节点都有一个关于G.nodes()的索引。我跟踪节点索引,因为我对邻接矩阵进行了一些计算,因为形容词矩阵中的每一行索引都对应于G.nodes()中的节点索引。但是现在我想向图中添加新节点,这会改变旧节点的索引吗?
我不会移除任何节点。
G = nx.Graph()
#add some nodes to G.
#record the indices of those nodes in a dictionary that maps from a node name to a node index from the list G.nodes()
#add
我见过这样命名的灵丹妙药模块:
defmodule Foo.bar.baz do
end
但我找不到任何文件说明什么时候做这件事。
它与子目录有关吗?使用mix,我可以将我的模块放在lib文件夹中的子目录中,它们没有点就能正常工作。
例如:
# this is in /lib/foo/bar
defmodule Bar do
end
会议是什么?
我感觉这可能是我应该知道的事情,但我现在想不起来。我正在尝试获取一个函数来构建一个列表,其中列表的名称是函数中给定的参数;
例如:
def make_hand(deck, handname):
handname = []
for c in range(5):
handname.append(deck.pop())
return handname
# deck being a list containing all the cards in a deck of cards earlier
问题是,这会创建一个名为handname的列表,而无论用户