-3

I want to run the biconnected graph algorithm on a graph using GraphFrames running with pyspark 2.3.

I reaized that all the built in algorithms are running under the hood with GraphX in Scala.

Does there is a way that I can implement the biconnected algorithm in scala - GraphX and than call it on the GraphFrames object?

Is anyone familiar with an such a solution?

Ron F
  • 370
  • 2
  • 14

1 Answers1

-1

No, I am not familiar with any solution; I believe it cannot be done with those programs, best bet is to make your own program with JavaScript (preferably), check out three.js if you want easy 3D graphing, if not, just use SVG to graph various shapes, or even pure CSS, here is some JavaScript code for creating a line from two points, just use that with an array of points to draw the graph (there are two functions / classes included here, one being a helper function to create DOM nodes in general):

var Grapher = new (function() {
    this.el = function(opts) {
        if(!svgList.split(" ").find(x => x == opts.tag)) {
            this.node = document.createElement(opts.tag || "div");
        } else {
            this.node = document.createElementNS('http://www.w3.org/2000/svg', opts.tag);
        } 

        for(var k in opts) {
            if(k == "style") {
                for(var s in opts[k]) {
                    this.node.style[s] = opts[k][s];
                }
            } else if(k != "parent"){
                this.node[k] = opts[k];
            }
        }



        this.setAttrs = (attrs) => {
            for(var k in attrs) {
                this.node.setAttribute(k, attrs[k]);
            }
        };
        this.getAttr = (at) => {
            return this.node.getAttribute(at);
        };

        this.setStyle = (stl) => {
            for(var k in stl) {
                this.node.style[k] = stl[k];
            }
        }

        var attr = opts.attr || {};
        this.setAttrs(attr);
        var optsPar = opts.parent;
        var par = null;
        if(optsPar) {
            if(optsPar.constructor == String) {
                par = f("#" + optsPar);
            } else if(optsPar instanceof Element) {
                par = optsPar;
            }
        }

        this.parent = par || document.body || {appendChild: (d) => {}};
        this.parent.appendChild(this.node);
     };
    this.line = (opts) => {
        var start = opts.start || {x:0,y:0},
            end = opts.end || {x:0,y:0},
            rise = end.y - start.y,
            run = end.x - start.x,
            slope = rise / run,
            boxWidth = Math.sqrt((rise * rise) + (run * run)),
            degAngle = Math.atan(slope) * 180 / Math.PI,
            thickness = opts.thickness || "2",
            holder = new this.el({
                attr: {
                    class:"lineBox"
                },
                style: {
                    position:"absolute",
                    left:start.x,
                    top:start.y,
                    width:`${boxWidth}px`,
                    height:`${thickness}px`,
                    transform:`rotate(${degAngle}deg)`,
                    transformOrigin:"0 0",
                    background:opts.texture || "black"
                },
                 parent:opts.parent

            });
    }
})();

then to use the line function for graphing various lines (from point to point):

Grapher.line({
    start: {
        x:2,
        y:200
    }
    end: {
        x:10,
        y:500
    }
});
Yaakov5777
  • 309
  • 5
  • 15