Пример #1
0
def main():
	'''

	main()
	
	Out: Three images have been saved,
		1) A bipartite Halin graph, bdg_halin0.png
		2) Its corresponding mobile, bdg_mobile.png
		3) The planar map corresponding to the mobile, bdg_halin1.png.
			Note: not necessarily the same graph as 1), since
			the BDG bijection depends on the embedding of the graph.

	'''

	
	# Make a mobile
	T = graphUtil.sampleTree()
	
	M = treeToMobile.treeToMobile( T, labels = 2 )

	# Map the mobile to a graph.
	G = mobileToGraph( M, eps = graphUtil.coin() )

	graphUtil.saveGraph( M, 'bdg_M' )
	graphUtil.saveGraph( G, 'bdg_G' )
Пример #2
0
def main():
    '''

	main()
	
	Out: Three images have been saved,
		1) A bipartite Halin graph, bdg_halin0.png
		2) Its corresponding mobile, bdg_mobile.png
		3) The planar map corresponding to the mobile, bdg_halin1.png.
			Note: not necessarily the same graph as 1), since
			the BDG bijection depends on the embedding of the graph.

	'''

    # Make a mobile
    T = graphUtil.sampleTree()

    M = treeToMobile.treeToMobile(T, labels=2)

    # Map the mobile to a graph.
    G = mobileToGraph(M, eps=graphUtil.coin())

    graphUtil.saveGraph(M, 'bdg_M')
    graphUtil.saveGraph(G, 'bdg_G')
Пример #3
0
n = 101

w = [1, 0, 1]

xi = 1. * np.array(w) / sum(w)

mob_lab = 1

# ---------------------------------------------
# ---------------------------------------------

#print 'Make tree...'
T = makeTree.generateTree(xi, n)

#print 'Map to mobile...'
M = treeToMobile.treeToMobile(T, mob_lab)

#print 'Map to planar...'
G = bdg.mobileToGraph(M, graphUtil.coin())

# ---------------------------------------------
# ---------------------------------------------

#graphUtil.saveGraph( G, 'maxim', draw = True, write = False, prog = 'fdp' )

Nodes = G.nodes()

d = nx.diameter(G)

count = 0
Пример #4
0
# 1 for deterministic labels
# 2 for random labels
mob_lab = 2



# ---------------------------------------------
# ---------------------------------------------


print 'Make tree...'
T = makeTree.generateTree( xi, n )


print 'Map to mobile...'
M = treeToMobile.treeToMobile( T, labels = mob_lab )


print 'Save mobile...'
graphUtil.saveGraph( M, file_name + 'mobile' )


print 'Map to planar...'
G = bdg.mobileToGraph( M, graphUtil.coin() )




# Appearance
Point = dict(zip( G.nodes(), [ 'point' ] * len(T) ))
Red   = dict(zip( G.nodes(), [ 'red' ] * len(T) ))
Пример #5
0
n = 101

w = [1,0,1]

xi = 1. * np.array(w) / sum(w) 

mob_lab = 1

# ---------------------------------------------
# ---------------------------------------------

#print 'Make tree...'
T = makeTree.generateTree(xi,n)

#print 'Map to mobile...'
M = treeToMobile.treeToMobile( T, mob_lab )

#print 'Map to planar...'
G = bdg.mobileToGraph( M, graphUtil.coin() )


# ---------------------------------------------
# ---------------------------------------------


#graphUtil.saveGraph( G, 'maxim', draw = True, write = False, prog = 'fdp' )


Nodes = G.nodes()

d = nx.diameter(G)
Пример #6
0
# 1 for deterministic labels
# 2 for random labels
mob_lab = 2



# ---------------------------------------------
# ---------------------------------------------


print 'Make tree...'
T = makeTree.generateTree( xi, n )


print 'Map to mobile...'
M = treeToMobile.treeToMobile( T, labels = mob_lab )


print 'Save mobile...'
graphUtil.saveGraph( M, file_name + 'mobile' )


print 'Map to planar...'
G = bdg.mobileToGraph( M, graphUtil.coin() )




# Appearance
Point = dict(zip( G.nodes(), [ 'point' ] * len(T) ))
Red   = dict(zip( G.nodes(), [ 'red' ] * len(T) ))