Beispiel #1
0
def main():  # pragma: no cover
    # Load data from saved pickle files
    category = "astrophysics"  # arxiv = stat.ML / astro-ph / stat  # mag = machine_learning / astrophysics / statistics
    edge_pickle_arxiv = "../pickle_file/edges_arxiv_{0}.pkl".format(category)
    node_pickle_arxiv = "../pickle_file/nodes_arxiv_{0}.pkl".format(category)
    edge_pickle_mag = "../pickle_file/mag_co_author_edges_{0}.pkl".format(
        category)
    node_pickle_mag = "../pickle_file/mag_co_author_nodes_{0}.pkl".format(
        category)

    edge_weight_arxiv = "../pickle_file/edges_weight_arxiv_{0}.pkl".format(
        category)
    node_weight_arxiv = "../pickle_file/nodes_weight_arxiv_{0}.pkl".format(
        category)
    edge_weight_mag = "../pickle_file/edges_weight_mag_spec_{0}.pkl".format(
        category)
    node_weight_mag = "../pickle_file/nodes_weight_mag_spec_{0}.pkl".format(
        category)

    # auth_graph_pickle = "../pickle_file/mag_co_author_graph_{0}.pkl".format(category)
    # auth_graph_pickle = "../pickle_file/mag_weight_co_author_graph_{0}.pkl".format(category)
    # auth_graph_pickle = "../pickle_file/arxiv_co_author_graph_{0}.pkl".format(category)
    # auth_graph_pickle = "../pickle_file/arxiv_weight_co_author_graph_{0}.pkl".format(category)

    signal = ""  # weight for weighted graph  # null
    # use for non-weighted
    edge_file = edge_pickle_mag  # arxiv # mag
    node_file = node_pickle_mag  # arxiv # mag

    # use for weighted
    #edge_file = edge_weight_arxiv     # arxiv # mag
    #node_file = node_weight_arxiv     # arxiv # mag

    auth_graph = loadGraphPickle(edge_file, node_file, signal)
    #with open(auth_graph_pickle, 'wb') as f:
    #   pickle.dump(auth_graph, f)

    node_count, edge_count = basicStats(auth_graph)
    deg = calcCentrality(auth_graph)

    # Plot results

    histo_title = "mag"  # arxiv # mag
    signal = "double_log"  # single_log: log(fraction)  # double_log: log(fraction) vs log(deg)
    label = "Log"  # log   # <empty>
    x_title = "log"  # log # <empty>
    weighted = ""  # weighted  # <empty>
    dp.drawHistogramSequence(deg, node_count,
                             ("{0}_{1}_{2}_simple_deg_distro").format(
                                 histo_title, category, weighted), "Degree")
    dp.drawLogHistogram(deg, node_count, signal,
                        ("{0}_{1}_{2}_{3}_log_deg_distro").format(
                            histo_title, category, weighted, x_title),
                        "{0} Degree".format(label), "Log Fraction")
def createGraphFromInputs(mainFrame):
    graphSettings = ConfigGraphFile.getFileConfigs()
    for i in range(len(mainFrame.graphInputs)):
        lista, period, startBit = ListCleaning.clearList(
            mainFrame.graphInputs[i])
        lista = ListCleaning.convertList(lista)
        print(period)
        graph = DrawGraph.drawGraph(
            5,
            10,
            lista,
            len(lista),
            height=graphSettings[7],
            sizeDivision=0.05,
            zoom=1000,
            fontSize=graphSettings[0],
            fontColor=QtGui.QColor(graphSettings[2][0], graphSettings[2][1],
                                   graphSettings[2][2]),
            fontStyle=graphSettings[1],
            lineThick=graphSettings[6],
            lineColor=QtGui.QColor(graphSettings[4][0], graphSettings[4][1],
                                   graphSettings[4][2]),
            divisionLineColor=QtGui.QColor(graphSettings[5][0],
                                           graphSettings[5][1],
                                           graphSettings[5][2]),
            backgroundColor=QtGui.QColor(graphSettings[3][0],
                                         graphSettings[3][1],
                                         graphSettings[3][2]))
        scrollArea = QtGui.QScrollArea()
        scrollArea.setWidget(graph)
        mainFrame.grid.setRowMinimumHeight(
            i + 1, 10 + graphSettings[7] + graphSettings[0] * 2 + 20)
        #mainFrame.grid.addWidget(scrollArea, i+1, 2,i+6,10)
        mainFrame.grid.addWidget(scrollArea, i + 1, 2, i + 1, 10)
Beispiel #3
0
def run():
#ターミナルコマンド
    cmd = "ls"
    subprocess.call(cmd, shell=True)

#データ読み込みと集計、結果をCSVで出力
    rawdatafiles = ReadData.rawfilelisting("../data/updates/YoutubePakistan/")
    #ReadData.readupdatedata(rawdatafiles)

#データチェック
#    ReadData.checklink()
#    ReadData.checkupdate()

# CSVからグラフへ
    timerange = 60
    number_of_files = int(timerange / 15)
    DrawGraph.draw(number_of_files) #15分間分のファイル 4つ分読み込んでグラフへ
Beispiel #4
0
 def insertGraph(self):
     lista=[1,0,1,1,1,0,1,0,1,1,1,0,0,1,1,0,0,1]
     size=500
     PosX=10
     PosY=10
     self.graph = DrawGraph.drawGraph(PosX, PosY, lista,size, self.graphHeight,size/len(lista), 'ms', 1, self.fontSize, self.fontColor, self.fontStyle, self.lineThick, self.lineColor, self.divisionLineColor, self.backgroundColor)
     scrollArea=QtGui.QScrollArea()
     scrollArea.setWidgetResizable(True)
     scrollArea.setWidget(self.graph)
     self.grid.addWidget(scrollArea, 0,3,7,20)
def main(): # pragma: no cover
    mongo_url = "mongodb://*****:*****@xxx:xxx/arxiv"
    
    collection_name = "machine_learning" # machine_learning # astrophysics # statistics
    # edge_pickle_file = "../pickle_file/mag_spec_cn_edges_{0}.pkl".format(collection_name)
    # node_pickle_file = "../pickle_file/mag_spec_cn_nodes_{0}.pkl".format(collection_name)
    graph_file = ("../pickle_file/mag_spec_cn_graph_{0}.pkl").format(collection_name)
    
    # load the graph
    graph = None
    with open(graph_file, 'rb') as f:
        graph = pickle.load(f)

    nodes_count, edges_count = directGraphBasicStat(graph)
    in_d,out_d = calcDeg(graph)
    
    signal = "double_log"   # single_log: log(fraction)  # double_log: log(fraction) vs log(deg)
    dp.drawHistogramSequence(in_d,nodes_count,("mag_{0}_simple_in_deg_distro").format(collection_name),"In Degree")
    dp.drawHistogramSequence(out_d,nodes_count,("mag_{0}_simple_out_deg_distro").format(collection_name),"Out Degree")
   
    dp.drawLogHistogram(in_d,nodes_count,signal,("mag_{0}_log_log_in_deg_distro").format(collection_name),"Log In Degree", "Log Fraction")
    dp.drawLogHistogram(out_d,nodes_count,signal,("mag_{0}_log_log_out_deg_distro").format(collection_name),"Log Out Degree", "Log Fraction")
def createGraph():
    graphSettings = ConfigGraphFile.getFileConfigs()
    graph = DrawGraph.drawGraph(
        5,
        10 + 240 - graphSettings[7] - 2 * graphSettings[0], [],
        550,
        height=graphSettings[7],
        sizeDivision=1,
        zoom=50,
        fontSize=graphSettings[0],
        fontColor=QtGui.QColor(graphSettings[2][0], graphSettings[2][1],
                               graphSettings[2][2]),
        fontStyle=graphSettings[1],
        lineThick=graphSettings[6],
        lineColor=QtGui.QColor(graphSettings[4][0], graphSettings[4][1],
                               graphSettings[4][2]),
        divisionLineColor=QtGui.QColor(graphSettings[5][0],
                                       graphSettings[5][1],
                                       graphSettings[5][2]),
        backgroundColor=QtGui.QColor(graphSettings[3][0], graphSettings[3][1],
                                     graphSettings[3][2]))
    return graph
Beispiel #7
0
import DrawGraph

V, E = map(int, input().split())

vertices = []
edges = []
for i in range(V):
    vertices.append(input())

for i in range(E):
    u, v = input().split()
    edges.append((u, v))

draw = DrawGraph.DrawGraph(vertices=vertices,
                           edges=edges,
                           weight=[1, 2],
                           directed=True)

draw.colorVertices([], 'sds')
draw.colorEdges([], 'sds')
draw.show()
import GraphCreator
import DrawGraph
import networkx as nx
"""
This script is meant to draw the specified actor, as well as all the actors they've worked with
"""
"""
Specify actor name here
"""
actor_name = 'Tom Hanks'

g = GraphCreator.json_to_graph("data.json")

hub_list = [actor_name]
for movie in nx.neighbors(g, actor_name):
    hub_list.append(movie)
    for actor in nx.neighbors(g, movie):
        hub_list.append(actor)

g_small = g.subgraph(hub_list)
DrawGraph.draw_graph(g_small, True)
Beispiel #9
0
 def pie(self):
     data = self.aggregate()
     Draw.draw_pie(data)
Beispiel #10
0
 def bar(self):
     data = self.aggregate()
     Draw.draw_bar(data)
import GraphCreator
import DrawGraph
"""
Display the entire graph
"""

DrawGraph.draw_graph(GraphCreator.json_to_graph('data.json'))