stools-core/src/main/java/ch/uzh/ddis/stools/scheduler/Sendgraph.java
public synchronized String toJson() {
        Map<String, Object> data;
        List<Map<String, String>> nodes;
        List<Map<String, Object>> links;
        Gson gson;
        String result;

        data = new HashMap<>();

        nodes = new ArrayList<>();
        for (Integer nodeId : nodeIds) {
            Map<String, String> name = new HashMap<>();
            name.put("name", nodeId.toString());
            nodes.add(name);
        }
        data.put("nodes", nodes);

        links = new ArrayList<>();
        for (Integer fromNode : this.graph.rowKeySet()) {
            for (Integer toNode : this.graph.columnKeySet()) {
                if (!fromNode.equals(toNode) && // todo: find out where these come from
                        this.graph.contains(fromNode, toNode)) {
                    Map<String, Object> values = new HashMap<String, Object>();
                    values.put("source", fromNode);
                    values.put("target", toNode);
                    values.put("value", this.graph.get(fromNode, toNode));
                    links.add(values);
                }
            }
        }
        data.put("links", links);

        gson = new Gson();
        result = gson.toJson(data);
        return result;
    }
/**
     * Creates and returns a Json representation of the graph in the form as it is expected by the Sankey hmtl file
     * used to visualize the graphs.
     *
     * @return the json representation.
     */
Creates and returns a Json representation of the graph in the form as it is expected by the Sankey hmtl file
used to visualize the graphs.

@return the json representation.
Creates and returns a Json representation of the graph in the form as it is expected by the Sankey hmtl file used to visualize the graphs . @return the json representation .
public synchronized String toJson() {
        Map<String, Object> data;
        List<Map<String, String>> nodes;
        List<Map<String, Object>> links;
        Gson gson;
        String result;
        data = new HashMap<>();
        nodes = new ArrayList<>();
        for (Integer nodeId : nodeIds) {
            Map<String, String> name = new HashMap<>();
            name.put("name", nodeId.toString());
            nodes.add(name);
        }
        data.put("nodes", nodes);
        links = new ArrayList<>();
        for (Integer fromNode : this.graph.rowKeySet()) {
            for (Integer toNode : this.graph.columnKeySet()) {
                if (!fromNode.equals(toNode) && 
                        this.graph.contains(fromNode, toNode)) {
                    Map<String, Object> values = new HashMap<String, Object>();
                    values.put("source", fromNode);
                    values.put("target", toNode);
                    values.put("value", this.graph.get(fromNode, toNode));
                    links.add(values);
                }
            }
        }
        data.put("links", links);
        gson = new Gson();
        result = gson.toJson(data);
        return result;
    }
public synchronized String toJson ( ) { Map < String , Object > data ; List < Map < String , String > > nodes ; List < Map < String , Object > > links ; Gson gson ; String result ; data = new HashMap < > ( ) ; nodes = new ArrayList < > ( ) ; for ( Integer nodeId : nodeIds ) { Map < String , String > name = new HashMap < > ( ) ; name . put ( "name" , nodeId . toString ( ) ) ; nodes . add ( name ) ; } data . put ( "nodes" , nodes ) ; links = new ArrayList < > ( ) ; for ( Integer fromNode : this . graph . rowKeySet ( ) ) { for ( Integer toNode : this . graph . columnKeySet ( ) ) { if ( ! fromNode . equals ( toNode ) && this . graph . contains ( fromNode , toNode ) ) { Map < String , Object > values = new HashMap < String , Object > ( ) ; values . put ( "source" , fromNode ) ; values . put ( "target" , toNode ) ; values . put ( "value" , this . graph . get ( fromNode , toNode ) ) ; links . add ( values ) ; } } } data . put ( "links" , links ) ; gson = new Gson ( ) ; result = gson . toJson ( data ) ; return result ; }
Creates and returns a Json representation of the graph in the form as it is expected by the Sankey hmtl file
 used to visualize the graphs.
Creates and returns a Json representation of the graph in the form as it is expected by the Sankey hmtl file used to visualize the graphs .
// todo: find out where these come from