Distribution of the number of linked questions

0

Please login or register to vote for this query.

(click on this box to dismiss)

MathOverflow

Q&A for professional mathematicians

WITH AllLinks AS (SELECT PostId, RelatedPostId
  FROM PostLinks
  WHERE LinkTypeId = 1 -- linked question
UNION -- sometimes, a question pair appears in both orders
SELECT RelatedPostId, PostId
  FROM PostLinks
  WHERE LinkTypeId = 1 -- linked question
)
SELECT Degree, ROUND(LOG(COUNT(*), 10), 2) AS 'Frequency (log_10)'
FROM
(SELECT PostId AS [Post Link], COUNT(*) AS 'Degree'
  FROM AllLinks AS l  
-- PostLinks contains links to deleted questions as well;
-- this makes sure they still exist.
  INNER JOIN Posts AS p ON l.RelatedPostId = p.Id
  GROUP BY PostId) AS Temp
GROUP BY Degree
UNION
SELECT 0,
(SELECT ROUND(LOG(COUNT(*), 10), 2)
  FROM Posts AS p
  LEFT OUTER JOIN AllLinks AS l
    ON l.PostId = p.Id
    WHERE l.PostId IS NULL)
ORDER BY 1

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results