SNAP Networks - Social circles: Facebook
DataSource: https://snap.stanford.edu/data/egonets-Facebook.html
DataSource: https://snap.stanford.edu/data/egonets-Facebook.html
Load data
Load data
In[]:=
data=SemanticImport["https://snap.stanford.edu/data/facebook_combined.txt.gz"];
In[]:=
Length[data]
Out[]=
88234
Built an edges table with the help of parallel computation
In[]:=
LaunchKernels[];edges=ParallelTable[data[[i,1]]data[[i,2]],{i,1,Length[data]}];CloseKernels[];
Take the first element to set up the graph.
In[]:=
g=Graph[edges[[1]]];
Add all other elements of edges apart from the first element.
In[]:=
f=EdgeAdd[g,Take[edges,-(Length[edges]-1)]]
Out[]=
Graph
Is f a graph?
In[]:=
MatchQ[f,_?GraphQ]
Out[]=
True
Graph Measures & Metrics
Graph Measures & Metrics
Distance Measures
Distance Measures
— length of the longest shortest path to every other vertex
For a connected graph, diameter, radius, periphery, and center can be computed by :
In[]:=
ecc=VertexEccentricity[f,#]&/@VertexList[f];
In[]:=
Max[ecc]
Out[]=
8
In[]:=
GraphDiameter[f]
Out[]=
8
In[]:=
Min[ecc]
Out[]=
4
In[]:=
GraphRadius[f]
Out[]=
4
In[]:=
Flatten[Position[ecc,Max[ecc]]](*resultsarecorrect*)
Out[]=
{1833,1834,1835,1836,1837,1838,1839,1840,1841,1842,1845,1846,1847,1848,1850,1851,1852,1853,1855,1856,1857,1858,1860,1861,1862,1863,1864,1866,1867,1868,1869,1870,1871,1872,1873,1874,1876,1877,1878,1879,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1892,1894,1895,1896,1897,1898,1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1916,1917,1919,1921,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1945,1947,1948,1952,1953,1954,1955,1958,1959,1960,1961,1962,1963,1964,1966,1967,1968,1970,1972,1973,1975,1977,1978,1979,1980,1981,1982,1983,1984,1985,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,3985,3986,3987,3988,3989,3990,3991,3992,3993,3994,3995,3996,3997,3998,3999,4000,4001,4002,4003,4004,4005,4006,4007,4008,4009,4010,4011,4012,4013,4014,4015,4016,4017,4018,4019,4020,4021,4022,4023,4024,4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4038,4039}
In[]:=
(*functionGraphPeriphery[f]deliverswrongresults*)
In[]:=
Flatten[Position[ecc,Min[ecc]]](*resultsarecorrect*)
Out[]=
{1711}
In[]:=
(*functionGraphCenter[f]deliverswrongresults*)