@Override
    public void execute(GraphModel graphModel, AttributeModel attributeModel) {
        Graph graph = graphModel.getGraphVisible();
        graph.readLock();


        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn erdosColumn = nodeTable.getColumn("erdosNumber");

        if (erdosColumn == null) {
            erdosColumn = nodeTable.addColumn("erdosNumber", "Erdös Number", AttributeType.INT, AttributeOrigin.COMPUTED, 0);
        }

        // http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/GraphAlgor/breadthSearch.htm
        Queue<Node> queue = new LinkedList<Node>();
        Set<Node> blacks = new HashSet<Node>();

        try {
            Progress.start(progressTicket, graph.getNodeCount());
            // init source node
            Node source = null;
            // if not set, select first
            if (sourceNode == null) {
                source = graph.getNodes().toArray()[0];
            } else {
                source = sourceNode;
            }
            // init source node as erdos to zero
            ((AttributeRow) source.getNodeData().getAttributes()).setValue(erdosColumn, 0);

            // start breadth search
            queue.add(source);
            double erdosSum = 0.0;
            Node current = null;
            while (queue.size() > 0) {
                current = queue.remove();
                for (Node gray : graph.getNeighbors(current)) {
                    if (!blacks.contains(gray)) {
                        // get current node attribute - erdos
                        int erdos = (Integer) ((AttributeRow) (current.getNodeData().getAttributes())).getValue(erdosColumn);
                        // erdos  +1
                        ((AttributeRow) gray.getNodeData().getAttributes()).setValue(erdosColumn, erdos + 1);
                        queue.add(gray);
                        blacks.add(gray);
                        erdosSum += (erdos + 1);
                    }
                }
                blacks.add(current);
                Progress.progress(progressTicket);
                if (cancel) {
                    break;
                }
            }

            // for all unconnected nodes set max
            if (blacks.size() < graph.getNodeCount()) {
                Set<Node> allNodes = new HashSet<Node>(Arrays.asList(graph.getNodes().toArray()));
                allNodes.removeAll(blacks);
                int erdos = (Integer) ((AttributeRow) (current.getNodeData().getAttributes())).getValue(erdosColumn);
                for (Node unconnected : allNodes) {
                    ((AttributeRow) unconnected.getNodeData().getAttributes()).setValue(erdosColumn, erdos + 1);
                }
                this.numberOfUnconnected = allNodes.size();
            }

            this.erdosAverage = erdosSum / (blacks.size() - 1);
            graph.readUnlockAll();
        } catch (Exception e) {
            e.printStackTrace();
            //Unlock graph
            graph.readUnlockAll();
        }

    }