function [Av_PathLength, num_cc, num_w_cc, diameter] = AveragePathLenght(Adj_Mat)

DiGraph = digraph((abs(Adj_Mat))');
min_path_length = 0;
counter = 0;
diameter = 0;

for id_row = 1:size(Adj_Mat,1)
    for id_col = 1:size(Adj_Mat,2)
        if id_row ~= id_col
            
            Path = shortestpath(DiGraph,id_row,id_col,'Method','unweighted');
            if not(isempty(Path))
                min_path_length = min_path_length + length(Path) - 1;
                counter = counter + 1;
            end

            diameter = max([diameter, (length(Path) - 1)]);

        end
    end
end

Av_PathLength = min_path_length / counter;

[~, binsizes] = conncomp(DiGraph);
num_cc = length(binsizes);

num_w_cc = max(conncomp(DiGraph,'Type','weak'));

end

