Commit 1f67a66c authored by Alexander Lercher's avatar Alexander Lercher

added multilayer result for querying

parent d94883d1
...@@ -28,19 +28,33 @@ paths: ...@@ -28,19 +28,33 @@ paths:
responses: responses:
200: 200:
description: "Successful echo of request data" description: "Successful echo of request data"
/graphinfo:
/agi/multilayer/multilayer.png:
get: get:
operationId: "rest.graphinfo.get" operationId: "rest.multilayer.get_image"
tags: tags:
- "GraphInfo" - "Multilayer"
summary: "Get info about clustered nodes" summary: "Returning the multilayer created from AGI data"
description: "Returns multiple metrics for all nodes created by analyzing and clustering the blockchain traces"
parameters: [] parameters: []
produces:
- "image/png"
responses: responses:
200: 200:
description: "Successful operation" description: "Successful echo of request data"
schema:
$ref: "#/definitions/NodeInfo" # /graphinfo:
# get:
# operationId: "rest.graphinfo.get"
# tags:
# - "GraphInfo"
# summary: "Get info about clustered nodes"
# description: "Returns multiple metrics for all nodes created by analyzing and clustering the blockchain traces"
# parameters: []
# responses:
# 200:
# description: "Successful operation"
# schema:
# $ref: "#/definitions/NodeInfo"
definitions: definitions:
NodeInfo: NodeInfo:
......
from flask import request, Response from flask import request, Response, send_file
from initialdemo.NodeInfo import NodeInfo
import pickle as json import pickle as json
import io def get_image():
from flask import request, Response return send_file("multilayer.png", mimetype="image/png")
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas \ No newline at end of file
from visualization.multilayer import *
from core import multinet
def get():
## multilayer
multilayer_network = multinet.multi_layer_network().load_network("/home/zarah/Downloads/multigraph2.gpickle", directed=False, input_type="gpickle_biomine")
multilayer_network.basic_stats() ## check core imports
multilayer_network.visualize_network(style="diagonal")
import visualization.multilayer as m
fig = m.main_figure
output = io.BytesIO()
FigureCanvas(fig).print_png(output)
return Response(output.getvalue(), mimetype="image/png")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment