GetNetworkDescription
(
String sSearchTerm,
WhatToInclude eWhatToInclude,
Int32 iMaximumStatuses,
GraphMLXmlDocument oGraphMLXmlDocument
)
{
Debug.Assert( !String.IsNullOrEmpty(sSearchTerm) );
Debug.Assert(iMaximumStatuses > 0);
Debug.Assert(iMaximumStatuses != Int32.MaxValue);
Debug.Assert(oGraphMLXmlDocument != null);
AssertValid();
const String Int32FormatString = "N0";
NetworkDescriber oNetworkDescriber = new NetworkDescriber();
Int32 iVertexXmlNodes = oGraphMLXmlDocument.VertexXmlNodes;
oNetworkDescriber.AddSentence(
// WARNING:
//
// If you change this first sentence, you may also have to change
// the code in
// TwitterSearchNetworkTopItemsCalculator2.GetSearchTerm(), which
// attempts to extract the search term from the graph description.
"The graph represents a network of {0} Twitter {1} whose recent"
+ " tweets contained \"{2}\", or who {3} replied to or mentioned"
+ " in those tweets, taken from a data set limited to a maximum of"
+ " {4} tweets."
,
iVertexXmlNodes.ToString(Int32FormatString),
StringUtil.MakePlural("user", iVertexXmlNodes),
sSearchTerm,
iVertexXmlNodes > 1 ? "were" : "was",
iMaximumStatuses.ToString(Int32FormatString)
);
oNetworkDescriber.AddNetworkTime(NetworkSource);
Boolean bIncludeFollowedEdges = WhatToIncludeFlagIsSet(eWhatToInclude,
WhatToInclude.FollowedEdges);
Boolean bIncludeRepliesToEdges = WhatToIncludeFlagIsSet(eWhatToInclude,
WhatToInclude.RepliesToEdges);
Boolean bIncludeMentionsEdges = WhatToIncludeFlagIsSet(eWhatToInclude,
WhatToInclude.MentionsEdges);
Boolean bIncludeNonRepliesToNonMentionsEdges = WhatToIncludeFlagIsSet(
eWhatToInclude, WhatToInclude.NonRepliesToNonMentionsEdges);
if (bIncludeRepliesToEdges && bIncludeMentionsEdges &&
bIncludeNonRepliesToNonMentionsEdges)
{
// Every collected tweet has an edge that contains the date of the
// tweet, so the range of tweet dates can be determined.
oNetworkDescriber.StartNewParagraph();
TweetDateRangeAnalyzer.AddTweetDateRangeToNetworkDescription(
oGraphMLXmlDocument, oNetworkDescriber);
}
if (bIncludeFollowedEdges || bIncludeRepliesToEdges ||
bIncludeMentionsEdges || bIncludeNonRepliesToNonMentionsEdges)
{
oNetworkDescriber.StartNewParagraph();
}
if (bIncludeFollowedEdges)
{
oNetworkDescriber.AddSentence(
"There is an edge for each follows relationship."
);
}
if (bIncludeRepliesToEdges)
{
oNetworkDescriber.AddSentence(
"There is an edge for each \"replies-to\" relationship in a"
+ " tweet."
);
}
if (bIncludeMentionsEdges)
{
oNetworkDescriber.AddSentence(
"There is an edge for each \"mentions\" relationship in a"
+ " tweet."
);
}
if (bIncludeNonRepliesToNonMentionsEdges)
{
oNetworkDescriber.AddSentence(
"There is a self-loop edge for each tweet that is not a"
+ " \"replies-to\" or \"mentions\"."
);
}
return ( oNetworkDescriber.ConcatenateSentences() );
}